UART



  • Hooked up an FTDI USB/3_3 TTL cable to P3 and P4 as described in the quickref. I tried the command uart = UART(1, baudrate=9600) and get resource not available. Then, I discovered that uart is already a variable. Looked at boot.py and it reads

    '# boot.py -- run on boot-up\r\nimport os\r\nfrom machine import UART\r\nuart = UART(0, 115200)\r\nos.dupterm(uart)\r\n'

    Not the same port as defined in quickref and I do not get any characters on the USB/serial interface, nor can I type any.



  • OK. So I updated the firmware using the same FTDI cable attached to P0 (RX) and P1 (TX), with jumper for safe mode. Am now at release 0.9.3.b2, version d78a5a3 2016-11-05. uart shows up as 0 at 115200, which is the REPL port. Was able to hook the FTDI cable up to P3 (TX) and P4 (RX) and create a uart1 object using uart1=UART(1, baudrate=115200). I was able to send characters to the port and receive from it.

    What I really wanted was the REPL port though, so I switched the FTDI cable back to P0 and P1 and it is working as expected.



  • @ubiq_01 Thanks. I am looking at the pinout released this weekend. It shows UART0 RX on P0 and UART0 TX on P1. I see no UART function on P3 and P4..


  • Pybytes Beta

    I made an annotated photo of a working setup. Please see https://twitter.com/_rac01/status/795201584846217216

    best regards
    Ralf



  • Can't try anything until Mon. morning when I get back to work. Board is at work and only connects to my laptop, which is now at home.


  • administrators

    Are you using the latest firmware version? MicroPython 7713d55 on 2016-10-28 release='0.9.2.b2'? I only have a LoPy so this might be something specific to the WiPy2?

    I've been working with SPI and I2C the last few days and they've been working as expected. I also did some UART1 tests earlier today and also didn't have any problems. I wouldn't image there being any difference in the UART module between LoPy and WiPy 2 as they both use the same chip.



  • Tried both ways with fTDI RX & TX to WiPy RX & TX. Still nothing. Tried other variations of UART(x, baudrate=9600), using different values of x. Always throws resource not available exception. I have not been able to do anything useful with the board so far. I need 1-wire, I2C and analogs to work. UART is useful for debugging.


  • administrators

    It's a bad choice in the example... replace uart (the lower case ones) with uart1.

    Also I think the TX and RX pins should be the other way around. TX on the FTDI to P3 and RX to P4


 

Pycom on Twitter