2 years, 7 months ago.

Using MODSERIAL with a different Uart

I'm trying to use MODSERIAL to redirect the printf function down a serial port on my NUCLEO F401RE. My code with the straightforward serial works, but when I use the MODSERIAL to declare my uart, I get a message down the STM USB interface saying: "MODSERIAL must have a defined UART to function".

Code looks like this:

MODSERIAL uart(PC_6, PC_7, "modser");

int main() {
	uart.claim();            // capture <stdout>
	uart.printf("goes to thru the MODSERIAL library\r\n");
    printf("so does this!\r\n");  // after the last one, not preempting it.

1 Answer

2 years, 7 months ago.

Could you please show where the object "pc" is defined? I don't know much about this libary, but it looks like your modserial object is defined as "uart", but there is another object called "pc".

Sorry, my fault when I copied the code. pc should be replaced with uart.

posted by Joshua Cowpland 16 Nov 2017