What about UART serial port 5?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
ahebert
Posts: 4
Joined: Fri Nov 07, 2014 11:04 pm

What about UART serial port 5?

Post by ahebert » Fri Nov 07, 2014 11:13 pm

Questions:
Are there 5 or 6 serial ports available?
If 6, what are the pins for UART #5?
If 5, what is the expected behavior of the constructor call `UART(5)`

Elaboration:
Looking at the doc for pyb.uart: https://micropython.org/doc/module/pyb/UART, it says
Construct a UART object on the given bus. bus can be 1-6...
Then in the following paragraph:
The physical pins of the UART busses are:

UART(4) is on XA: (TX, RX) = (X1, X2) = (PA0, PA1)
UART(1) is on XB: (TX, RX) = (X9, X10) = (PB6, PB7)
UART(6) is on YA: (TX, RX) = (Y1, Y2) = (PC6, PC7)
UART(3) is on YB: (TX, RX) = (Y9, Y10) = (PB10, PB11)
UART(2) is on: (TX, RX) = (X3, X4) = (PA2, PA3)
UART(5) is not given. Does it exist?

Thanks!

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: What about UART serial port 5?

Post by dhylands » Sat Nov 08, 2014 12:58 am

There is a UART5, but it's mapped onto CPU pins PC12 & PD2

On the pyboard, PC12 goes to the sdcard connector to be used for SDIO_CK, and PD2 goes to the sdcard connector to be used for the SDIO CMD signal.

So, in order to use UART5, you would lose the ability to use the sdcard.

ahebert
Posts: 4
Joined: Fri Nov 07, 2014 11:04 pm

Re: What about UART serial port 5?

Post by ahebert » Sat Nov 08, 2014 1:51 am

Ah, that makes sense. Thanks for your reply!

Does it require any special code or firmware besides `uart(5)` to use those serial port pins (and override the pins as used the SD card)? For example, would I need to use the `pyb.Pin` class?

(BTW, I'm asking for a project that uses 6 serial ports, and it'd be great to do it all with one board.)

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: What about UART serial port 5?

Post by dhylands » Sat Nov 08, 2014 2:30 am

It looks like you'd need to add an entry for UART5 to this file:
https://github.com/micropython/micropyt ... #L186-L208

and here:
https://github.com/micropython/micropyt ... #L563-L572

Some other boards, like the STM32F407 Discovery or perhaps the http://www.wvshare.com/product/Core405R.htm may give easier access to all of the UART pins than the pyboard does.

ahebert
Posts: 4
Joined: Fri Nov 07, 2014 11:04 pm

Re: What about UART serial port 5?

Post by ahebert » Sat Nov 08, 2014 3:11 am

Wow, thanks dhylands!

That's exactly what I was looking for in terms of what to change (in the firmware, in this case). And that ST evaluation board may be just the perfect thing (though I'm quite enamored with the pyboard at the moment. :)

Thanks again for your excellent help.

Post Reply