9 years, 6 months ago.

UART not working?

I'm having problems using UART pins PE0, PE1 (tx, rx) for serial interface to a 4DSystems Oled display, it will not communicate and freezes the program. Using default 9600 speed. The MCU resets the display as expected via a separate reset connection. I have checked the same program working on other platforms and tried other pins as defined in PeripheralPins.c

Any suggestions?

Question relating to:

Silicon Labs' EFM32™ Wonder Gecko ARM® Cortex®-M4 based 32-bit microcontrollers (MCUs) provide flash memory configurations up to 256 kB, 32 kB of RAM and CPU speeds up to 48 MHz, …

Hi Paul, can you give me more information on what you are trying to do, and how you are compiling your program? From the sound of it, the UART may not be initializing correctly, not getting a clock, and therefore the register write/read from TX/RX routines will stall the program. I'd like to debug this with you.

posted by Steven Cooreman 04 May 2015

Also, please note that we have not released these platforms officially yet, and so documentation is lacking. I can tell you that UART0 is the stdio UART for the Wonder Gecko (i.e. the one that will get connected to the CDC port), and because of a board limitation, the baud rate on that specific peripheral will be initialized to 115200 instead of the default 9600. You can override that by separately calling serial.baud(9600) on the serial port after initialization.

posted by Steven Cooreman 04 May 2015

Hi Steve, quite a simple serial interface to a Oled display that will work from 9600 to 256k baud. The default is 9600 (should be Mbed's default setting).

Compiling using the current version of Mbed libraries, converting the .bin to .hex and using simplicity studios flash programing utility.

Without the serial code, I can get the led1 to flash as a simple test, so confident the program is loading to the MCU. As you say it may be due to the serial initialising code.

edit..

Just seen your other message, the display must be initialised at 9600, so the 115200 will be the problem, I can change the display start up code and check.

Paul

posted by Paul Staron 04 May 2015

Hi Paul, thanks for your response. I did some more checking on my end, and it turns out the Leopard and Wonder Gecko boards are misconfigured (device_peripherals.h) to a 32MHz clock, when in reality, they have a 48MHz clock on board just like Giant Gecko.

Are you compiling using mbed or mbed-src? If the latter, can you please change the HFXO frequency definition in device_peripherals.h and retry?

posted by Steven Cooreman 04 May 2015

Changed the HFXO frequency definition to 48MHz, but no change, have you tried hardware with the serial port during development?

posted by Paul Staron 05 May 2015

Hi Paul, yes we have. Having changed the frequency to 48MHz, the Wonder Gecko board I have right here works happily with the serial port at 115kbaud, and should thus also work at 9600.

Are you using sleep() by any chance?

I'd like to dig further into this with you. Can you email me your project (or a link to where it lives on mbed.org) at [redacted]?

posted by Steven Cooreman 05 May 2015

1 Answer

9 years, 6 months ago.

For the benefit of others: the issue has now been identified and fixed in mbed-src, and will be available in the next release of mbed proper. Hopefully on Tuesday (26/05/2015).

Accepted Answer

Assigned to Steven Cooreman 9 years, 6 months ago.

This means that the question has been accepted and is being worked on.