WiPy 2.0 + Expansion Board 2.0 SD Card and UART1



  • Hi,

    It is possible to use the SD Card and the UART1 serial port at the same time?
    If not, Can I change the TX, RX pins for UART1?
    There is any table for the alternative function of the pins (alt parameter)?

    Thanks and best regards,



  • Hi,

    I had the same problem. I resolve it using the next code:

    from machine import SD
    import os

    uart=UART(1,baudrate=115200,pins=('P12','P11')) ## it is important to create uart before sd
    #uart.init(115200, bits=8, parity=None, stop=1,pins=('P3','P4'))
    #uart.init(115200, bits=8, parity=None, stop=1,pins=('P10','P9'))
    #uart.init(115200, bits=8, parity=None, stop=1,pins=('P12','P11'))

    while(uart.any()==0):
    pass
    uart.readall()

    sd = SD()
    os.mount(sd, '/sd')

    check the content

    os.listdir('/sd')

    try some standard file operations

    f = open('/sd/test.txt', 'w')
    f.write('Testing SD card write operations + serial to HPoseidon')
    f.close()
    f = open('/sd/test.txt', 'r')
    f.readall()
    f.close()

    I hope it will be useful. Sorry for mi English.

    Regards


Log in to reply
 

Pycom on Twitter