Skip to main content
Andrew Neil
Super User
August 12, 2015
Question

mbed Serial on Nucleo UART4

  • August 12, 2015
  • 10 replies
  • 2235 views
Posted on August 13, 2015 at 01:14

I have already asked this question on the mbed site:

https://developer.mbed.org/questions/59656/Serial-What-are-the-Supported-pins/

It isn't clear from the Handbook whether this is even supposed to be supported. I tried instantiating as:

Serial uart4( PC_10, PC_11 );

But is seems that can't be sufficient, as USART3 can also use PC10 & PC11 - so how could it know?! #fail #nucleo #nucleo #uart #mbed #possibly-worst-forum-software #serial #keil #mbed
This topic has been closed for replies.

10 replies

Tesla DeLorean
Guru
August 13, 2015
Posted on August 13, 2015 at 02:27

Well the ST-LINK VCP is definitely USART2 via PA2/PA3 on the

https://developer.mbed.org/platforms/ST-Nucleo-L152RE/

But somewhat irritatingly that conflicts with the D0/D1 of the header.

I'd have to wade through the manuals for USART3/UART4, but I could swear you'd have to manually modify the board to get those to the VCP TX/RX pins.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
August 13, 2015
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
August 13, 2015
Posted on August 13, 2015 at 02:46

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/DM00098321.pdf

UART4 would also be viable on these pins, if you really needed to use USART3 somewhere else and in synchronous mode. With 64-pins I find that a tad improbable.

Not into mbed myself, but would suspect calling out the U(S)ART and specifying the pins to select as AF, should be enough for the magic inside the board/chip support code to get the chip set up properly, provided you'd dealt with the wiring externally. 
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Andrew Neil
Super User
August 13, 2015
Posted on August 13, 2015 at 08:39

Sorry - I'm not talking about the 

 ST-LINK VCP  here at all.

I have serial comms with the PC over the 

ST-LINK VCP  working fine.

What I'm looking to do is to also have UART (or USART) comms on the header pins.

The UART4 pins seemed initially convenient - but any other pins would do.

I'm also not much into mbed (yet) - but the documentation on this does seem very skimpy (being kind).

:(

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Tesla DeLorean
Guru
August 13, 2015
Posted on August 13, 2015 at 19:06

I've use PA9/PA10 USART1 before.

PA10 (D2) USART1-RX is usable for GPS shield.

The Morpho header has more opportunities.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Andrew Neil
Super User
August 14, 2015
Posted on August 14, 2015 at 23:47

Experimenting further, I can successfully printf() to UARTs 1 & 3; but printf() to UART 4 or 5 hangs.

#include ''mbed.h''
//------------------------------------
// Hyperterminal configuration
// 9600 bauds, 8-bit data, no parity
//------------------------------------
Serial pc(SERIAL_TX, SERIAL_RX);
//Serial uart1( PA_9, PA_10 );
Serial uart1( PB_6, PB_7 );
Serial uart3( PB_10, PB_11 );
Serial uart4( PC_10, PC_11 );
Serial uart5( PC_12, PD_2 );
DigitalOut myled(LED1);
int main() {
int i = 1;
pc.printf(''


Hello World !'');
while(1) { 
wait(1);
pc .printf(''

SERIAL_TX: %d.'', i);
//uart1.printf(''

UART1: %d.'', i);
//uart3.printf(''

UART3: %d.'', i);
uart4.printf(''

UART4: %d.'', i);
//uart5.printf(''

UART5: %d.'', i);
i++;
myled = !myled;
}
}

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Tesla DeLorean
Guru
August 14, 2015
Posted on August 15, 2015 at 00:57

Yeah, I'd take a look at the board support code, and make sure it's enabling the right APB clocks for the USARTs

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Andrew Neil
Super User
August 15, 2015
Posted on August 15, 2015 at 13:03

Yes.

The online compiler seems pretty useless in getting to see that, and exporting seems to be broken at the moment.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Super User
August 19, 2015
Posted on August 19, 2015 at 13:43

Thoroughly cheesed-off with mbed, Keil, and Nucleo at the moment!

:(

As noted, the debugging and browsing in the online compiler is pretty useless; so I thought I'd export to Keil.

But the mbed Export function is not working - everything is just stuck in the cloud.

:(

I eventually found a way to export something, but the Project does not build - and Keil's error message is unhelpful

http://www.keil.com/forum/60126

:(

I did finally get the project to build, only to find that it doesn't have the 

board support as source code anyhow - so useless for debugging this issue!!

:(

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Super User
August 19, 2015
Posted on August 19, 2015 at 13:46

And, just to make me feel so much better, the stupid forum software decided to swallow my post, too!

:(

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.