Serial1.setup hangs IDE cmd line with Pico

Posted on
  • This works on original Espruion but hangs IDE cmd line window on Pico 1v75 & 1v77
    Do I need to do something different on Pico?

    print("start");
    Serial1.setup(9600);
    print("end");
    

    Change to serial 2 works fine

    Serial2.setup(9600);
    

    Thanks

  • Does it work if you explicitly set the pins up?

    My guess is it's defaulting to the lowest numbered pins with serial - A9/10, but one of those is USB vsense, which could maybe cause the chip problems when configured as an output but also fed with 5v.

    If that's the case I can just disable serial1 using A9 in the next firmware

  • -- Does it work if you explicitly set the pins up?
    No :( just calling Serial1.setup causes the issue.

    Also can I clarify my understanding Serailx x is an instance of serial class/obj.
    By defining the correct rx/rx pins in .setup I can use usart1 (rx:b7 , tx:b6) or usart2 (rx:a3 , tx:a2) ?
    So this will work

    // usart1 via serial2
    Serial2.setup(57600,{rx:b7,tx:b6,bytesiz­e:8,parity:none,stopbits:1});
    
  • No :( just calling Serial1.setup causes the issue.

    Try this:

    print("start"); Serial1.setup(9600, {rx:B7,tx:B6}); print("end");
    

    It works for me. I think you weren't capitalising the pin names so they were just being set to undefined?

    By defining the correct rx/rx pins in .setup I can use usart1 (rx:b7 , tx:b6) or usart2 (rx:a3 , tx:a2) ?

    Afraid not - SerialX is an instance of the Serial class, but it is tied to a specific hardware peripheral, so to use USART1 you need Serial1 and so on...

  • @Gordon thanks as always now cooking on gas!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Serial1.setup hangs IDE cmd line with Pico

Posted by Avatar for LawrenceGrif @LawrenceGrif

Actions