2024-07-28 11:00 AM - edited 2024-07-28 11:08 AM
Hi,
I am Faruk.
What i am trying to do is, sending data that i collacted from ADC Ports to Nextion HMI Display. Also at the same time i am getting signals from buttons on the Nextion HMI Display. I use UART pins of Nextion HMI Display. 5V RX TX GND.
If i dont transmit any data to HMI Display i can get signals from buttons on HMI Display. One of the buttons start saving data to SD Card. The other ones increase and decrease the output signal that goes out from DAC.
When i use receive and transmit at the same time. Only transmit section works. I cannot get signal from buttons on HMI Display. I am uploading the code here. I just couldnt figure it out why it doesent work correctly. I need some help about this situation. This is my final project. I am gonna test it on Friday. So i have to figure it out. I also uploaded the main.c file.
2024-07-30 10:09 AM
@frkdkk wrote:When i use receive and transmit at the same time. Only transmit section works. I cannot get signal from buttons on HMI Display
Not sure what you mean here?
"Transmit" refers to sending stuff from your STM32 to the Display - yes?
"Receiving" refers to stuff coming from the Display into your STM32 - yes?
What "signal" do expect to get from the Display ?
Is the problem with the Display not sending, or with the STM32 not receiving?
Please see the posting tips for how to properly post source code:
2024-09-11 05:04 PM
use the </> when posting code so that it gets properly formatted. Makes it easier to read the code.
You're doing to much processing in the HAL_UART_RxCpltCallback
Instead, save the data to a secondary buffer and set a flag, enable the UART interrupt, then exit the interrupt.
Then check the flag in your main while loop and do the processing of the secondary buffer. All the while the UART can still receive data in the primary buffer during your processing.
2024-09-11 05:09 PM
Now that i look at more of your code, you are using blocking code when transmitting. You should use interrupts or DMA along with a queue buffer.
See this project https://github.com/karlyamashita/Nucleo-G431RB_Three_UART/wiki