Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 8 months ago.
Serial port alternate PINs, STM32F334R8
Hi all,
on my custom board I use PC_4 for TX and PC_5 for RX (USART), however if I use Serial with (PC_4, PC_5) i get the error: Error: Identifier "PC_4" is undefined in "main.cpp", Line: 8, Col: 13
#include "mbed.h" DigitalOut red_led(LED1); DigitalOut blue_led(LED2); DigitalOut orange_led(LED3); DigitalOut green_led(LED4); Serial pc (PC_4,PC_5); int main() { while(1) { // LEDs ON red_led = 1; wait(0.2); // wait 200 ms blue_led = 1; wait(0.2); // wait 200 ms orange_led = 1; wait(0.2); // wait 200 ms green_led = 1; wait(0.2); // wait 200 ms // LEDs OFF red_led = 0; blue_led = 0; orange_led = 0; green_led = 0; pc.printf(""); wait(0.5); // wait 500 ms }
Any workarround?
1 Answer
7 years, 8 months ago.
Hello Gorazd,
Which target board are you trying to compile for? I don't see the STM32F344R8 among the boards supported by mbed. So I guess it could be the NUCLEO-F334R8. But when using the online comiler your program copiles without any error for that board.
Hi,
yes I corrected my misstyped error. The uC is STM32F334R8. Allso using online compyler I get the same error.
posted by 27 Mar 2017That's strange. I have tested your program again and for me it compiles smoothly for the NUCLEO-F334R8 target with the last compiled version of mbed library (revision 138). How did you compile online? The NUCLEO-F334R8 is not listed on your profile page. Which version and revision of mbed library do you use? Try to delete the current mbed library from your project and import the latest. If it still doesn't work and you'd like to test it I can publish my project with your program so you can import it. Later on I will delete it from my repository.
NOTE:
When I tried to compile the project for the DISCO-F334C8 (listed on your profile page) then I have got the following errors:
Identifier PC_4 is undefined "Serial pc(PC_4, PC_5);"
Identifier PC_5 is undefined "Serial pc(PC_4, PC_5);"