Hi,
I'm using mikromedia+ for STM32 ARM board with STM32F407ZG MCU.
I try to UART communication with FT232 module using UART library.
// Code example
void Init_MCU() {
...
UART2_Init_Advanced(115200, _UART_8_BIT_DATA, _UART_NOPARITY, _UART_ONE_STOPBIT, &_GPIO_MODULE_USART2_PD5_PA3);
}
// Event Handler (when touchscreen pressed)
void touched() {
char* cmd = "Test";
char* receive;
...
UART2_Write_Text(cmd);
while (!UART2_Data_Ready());
receive[0] = (char)UART2_Read();
UART2_Write_Text("Receive Done");
}
Then I connect RX/TX pin to pin No. 47 & 48.
After compile and load to board then executed, but library functions don't work. (Nothing shows in terminal)
Please advice for me.
Thanks.
UART communication problem
UART communication problem
- Attachments
-
- MyProject.zip
- (715.87 KiB) Downloaded 62 times
- filip.grujcic
- Posts: 822
- Joined: 14 May 2018 08:34
Re: UART communication problem
Hello,
Have you configured the MCU clock correctly in the Edit Project window (Ctrl + Shift + E)?
You can click on the Load Scheme button and look for a scheme which suits your set up. There are many for STM32F407ZG.
Regards,
Have you configured the MCU clock correctly in the Edit Project window (Ctrl + Shift + E)?
You can click on the Load Scheme button and look for a scheme which suits your set up. There are many for STM32F407ZG.
Regards,
Filip Grujcic
Re: UART communication problem
Hi, filip
Thanks for your advice, I tried all configurations but still not work correctly.
For detail, I used STM32F407ZG_HSE_PLL_25MHz_to_168MHz configuration by default.
And I adjust MCU Clock Frequency to 150MHz.
What should I do more??
Thanks for your advice, I tried all configurations but still not work correctly.
For detail, I used STM32F407ZG_HSE_PLL_25MHz_to_168MHz configuration by default.
And I adjust MCU Clock Frequency to 150MHz.
What should I do more??
- Attachments
-
- configurations_VTFT.png (30.36 KiB) Viewed 1928 times
-
- configurations.png (7.56 KiB) Viewed 1928 times
Re: UART communication problem
Hi,
If you chosen the 168MHz profile, why did you enter 150 MHz frequency in the Device Clock input field ?
Regards,
Filip.
If you chosen the 168MHz profile, why did you enter 150 MHz frequency in the Device Clock input field ?
Regards,
Filip.
Re: UART communication problem
In VTFT settings, Hardware pattern is "Mikromedia_Plus_for_STM32_ARM" (default)
This pattern uses "VTFT_Mikromedia_Plus_for_STM32_HSE_PLL_25MHz_150MHz" scheme. (MCU frequency is 150MHz)
So, I matched scheme between General setting and VTFT setting. ("STM32F407ZG_HSE_PLL_25MHz_to_168MHz")
But it still not work correctly.
This pattern uses "VTFT_Mikromedia_Plus_for_STM32_HSE_PLL_25MHz_150MHz" scheme. (MCU frequency is 150MHz)
So, I matched scheme between General setting and VTFT setting. ("STM32F407ZG_HSE_PLL_25MHz_to_168MHz")
But it still not work correctly.
- filip.grujcic
- Posts: 822
- Joined: 14 May 2018 08:34
Re: UART communication problem
Hello,
Have you double checked that you didn't connect Rx to Rx and Tx to Tx by accident?
Kind regards,
Have you double checked that you didn't connect Rx to Rx and Tx to Tx by accident?
Kind regards,
Filip Grujcic
Re: UART communication problem
Yeah, I checked several times.
(Pin &47 is Rx that connected FT232's Tx, Pin &48 is Tx that connected FT232's Rx)
* Pin &47 : _GPIO_USART2_RX_PA3
* Pin &48 : _GPIO_USART2_TX_PD5
(Pin &47 is Rx that connected FT232's Tx, Pin &48 is Tx that connected FT232's Rx)
* Pin &47 : _GPIO_USART2_RX_PA3
* Pin &48 : _GPIO_USART2_TX_PD5
-
- Posts: 137
- Joined: 02 Jan 2020 19:00
Re: UART communication problem
Did you try to separate the problem?
Connect Pin 47 to Pin 48 and check in debug.
Connect Pin 47 to Pin 48 and check in debug.
Re: UART communication problem
Yes, I checked separately and debug mode.
But still problem exists...
In case of Soft_Uart library, write (send) is ok. (Because it send only 1 character repeatly)
Read (receive) is partially worked. (For example, Host send 30 characters, the board just receives 1/5 ~ 1/6)
But still problem exists...
In case of Soft_Uart library, write (send) is ok. (Because it send only 1 character repeatly)
Read (receive) is partially worked. (For example, Host send 30 characters, the board just receives 1/5 ~ 1/6)
Re: UART communication problem
Thanks to everyone, solved using H/W UART6 module and pin &45/46.