Need some help setting up UART5

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
User avatar
dhylands
Posts: 3212
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Need some help setting up UART5

Post by dhylands » Sun May 31, 2015 10:46 pm

I just did a PR to add UART5 support to the stmhal port.
https://github.com/micropython/micropython/pull/1299

I tested it on my CERB40 board which has UART5 exposed (and has no sdcard).
It seems to be working fine for that.

You may want to compare your code with mine to see where you're doing things differently. I think you were missing the IRQ handler whcih would cause the board to hang as soon as an imcoming character was received.

If I connect C12 to D2 then with the PR applied I see the following:

Code: Select all

Micro Python v1.4.3-74-g286ced4-dirty on 2015-05-31; Cerb40 with STM32F405RG
Type "help()" for more information.
>>> u5 = pyb.UART(5, 115200)
>>> u5.write('This is a test')
14
>>> u5.read(7)
b'This is'
>>> u5.read(7)
b' a test'

gradoj
Posts: 27
Joined: Mon Aug 11, 2014 5:47 pm

Re: Need some help setting up UART5

Post by gradoj » Mon Jun 01, 2015 2:32 am

The only real difference I could find - I copied the wrong interrupt handler so it read USART5 instead of UART5. :oops:

It is working now. Thanks again for your help.

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

Re: Need some help setting up UART5

Post by dhylands » Mon Jun 01, 2015 3:01 am

It looks like my PR got merged into the codebase (just an FYI)

Post Reply