-
Notifications
You must be signed in to change notification settings - Fork 3k
STM32L053C8 UART Error in Mbed2 Latter Than Rev159 #8045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
After I un-commented the Serial line, I probed the PB_4 pin (default LED1 on DISCO-L053C8 board) and its patterns matched the mbed_die(void) function in platform/mbed_board.c. Referring to #6019, I have added the following code into main.cpp and tried to redirect the stdio to UART2. I have probed the pin PA_2 and it was outputting the string in printf("1\r\n");. However, once I un-commented the Serial, the MCU executed the mbed_die routine.
|
After some digging, it looks like it is caused by the following code in /targets/TARGET_STM/serial_api.c:
I have double checked it on mbed-dev sources, and the above code was added since Release version 159, about 6 months ago. So I need to redefine the STDIO_UART_TX and STDIO_UART_RX. |
Hi Wiki page: https://os.mbed.com/teams/ST/wiki/STDIO
Yes, in a mbed_app.json file like : "target_overrides": { [Mirrored to Jira] |
Thanks @jeromecoutant , however, since I am using the online compiler, I suppose I do not have the mbed_app.json file. I tired to switch to mbed-cli, however, I facing the same issue mentioned here. Currently I would like to stick to the online compiler because its .bin file is smaller than that complied using GCC_ARM. If there is no way to redifine the STDIO_UART_TX and STDIO_UART_RX on the online compiler, I would redesign the custom board. |
See for ex https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-wifi/ You can add a mbed_app.json file with online compiler [Mirrored to Jira] |
@jeromecoutant After adding the mbed_app.json file as follows:
The macro STD_UART_TX and STD_UART_RX do change to PB_6 and PB_7. When I executed the following code, the led is blinking with 1 second interval, which means the STD_UART_TX becomes PB_6. However, when I probed the PA_9, it is outputting serial data, instead of PB_6. Moreover, once I un-comment the Serial line, the MCU is executing mbed_die() routine.
[Mirrored to Jira] |
Why do you want to re-configure PB_6 and PB_7. [Mirrored to Jira] |
Dear @jeromecoutant, in my last comment, the line Serial serial(PB_6, PB_7) was commented. Then I probed the pin PA_9 and PB_6 respectively, and PA_9 was outputting something instead of PB_6 (mbed_app.json was added). This is contradictory to what we expect, i.e. PB_6 should output something. In fact, I have tried (PA_14, PA_15), (PB_10, PB_11) and (PA_2, PA_3) in mbed_app.json. I must add the following code so that the corresponding TX pin could output something:
However, after I added the code above and tried (PB_6, PB_7) in mbed_app.json, the MCU went into mbed_die() routine. I am sure it was caused by the code below in /targets/TARGET_STM/serial_api.c:
It looks like in serial_api.c, the STDIO_UART_TX and STDIO_UART_RX are still referring to PA_9 and PA_10 respectively. Another interesting thing is that, I compile the above program (without FileHandle *mbed::mbed_override_console(int fd)) using mbed-cli (1.8.1) and probed the PA_9 and PB_6. None of them was outputting anything. [Mirrored to Jira] |
Internal Jira reference: https://jira.arm.com/browse/IOTPART-6500 |
@Tony-YI Should we close this issue? |
My custom board is STM32F103ZCT6, there is the same problem. After methods mentioned like above, the problem has been solved. Thx very much. |
Description
I am using a STM32L053C8 MCU and got some problems with it.
The code above works fine. However, after I un-commented the Serial, the LED stop blinking. As far as I know, (PB_6, PB_7) is the UART1 serial port. I tried the UART2 and LPUART1 and both of them works fine.
It looks like I can not define any UART1 port.I have tried (PA_9, PA_10) which is utilizing the UART1 and it worked. It looks like I could not define serial on (PB_6, PB_7).According to my previous experience, I switched the mbed-2 version to Rev.159:7130f32 (I am using the online compiler) and un-commented the Serial and it worked fine.
Jerome Coutant from ST said it is because the UART1 is already used by the default STDIO.My question is that can I disable the default STDIO and use the UART1 for my own purpose? Note that I am using the online compiler.Thanks in advance.
Issue request type
[X] Question
[ ] Enhancement
[ ] Bug
The text was updated successfully, but these errors were encountered: