-
Notifications
You must be signed in to change notification settings - Fork 73
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
Serial Timeout ERROR #4
Comments
Is there anyone got same error? |
Hello, @muhambykar Can you check the GPIOs that you are using as Rx and Tx? |
I have checked rx tx pins, I can write and erase with these pins on FlashLoaderDemo.exe but I couldnt it with esp32. I have tried directly Boot0 to HIGH, and I have also tried with #define BOOT0_PIN (GPIO_NUM_21) But got some error log. Is there anything that I can check? |
Is there anybody got same error? |
Hello, @muhambykar
|
Hello there, I found the solution. on ESP-IDF v4.0.x , I have listened the received packets from UART, then I figure out it and it works. I recommend it. |
This function was inserted as the STM32 flashing protocol works on USART, not UART. We have tested with two different versions of the chip (STM32F103 and STM32F072) and got successful results. Can you guys tell which STM32 chip are you using? |
Its not about STM32, its about ESP32. When we configure RTS manually iwth this function, ESP32 could not read data on Rx pin. So if we leave it with automatic configuration, it works. |
@muhambykar I am closing the issue for now. Reopen it if you have any updates regarding the problem. |
Hey I am getting the same error and tried everything mentioned above. Was someone able to solve it? |
I have the same issue, i tried all the solutions mentioned in this issue and then some more. Cant seem to point out why esp32 cant receive anything, even tried the uart_set_rts solution mentioned by @LetsControltheController . The UART example works but only when talking with STM it doesn't work. Any thoughts on the problem? |
Hello, Sorry for the late response. I will try reproducing this on my side and revert back to you. @akym and @madhavee77 Could you guys specify the following:
|
Hello, @akym Sorry for the late update. I was able to reproduce this issue on ESP-IDF branch Are you resetting the board before flashing? (if you are using the on-board RESET button, you will need to time it appropriately) |
Thank you for the effort. I tried the set_rts but it did not work. I am resetting the board with flipping ESP's GPIO pin to NRST of STM32F4, not manually. My code is attached in the original question, but it is almost the same as this repo. |
- Removed S/W RTS control in UART driver initialization
Hello, @akym I tried the example again on an I also had an
|
Hello @laukik-hase ,
I also tried following the AN3155 ('USART protocol used in the STM32 bootloader') from STM to see where things might not be working. maybe you can try having a look. That is when I probed the TX & RX pins with osci to see if there is anything. |
Hey everyone, sorry for the late reply. I was able to resolve this issue on my end. I first tested if the STM32 is working or not by putting it in bootloader mode and started sending the setup bytes manually to it at 115200 baud rate, even parity, using FTDI. Whenever I sent something, I was receiving the Acknowledgement byte which is 0x79. Which proved there was nothing wrong with STM32. Then I tried testing a basic UART example of ESP32 with the same settings as in this code (even including uart_set_rts(UART_CONTROLLER, 1);). That's when I found that the issue was because of this function in the stm_pro_mode.c line 244. waitForSerialData(); Most probably the function uart_get_buffered_data_len() is the issue and is not reading anything on the receiving line whenever STM32 sends something back. This function is not able to read the incoming data, maybe its supporting libraries are not available on the latest version or whatever is the reason I don't know but this was the issue on my end. I removed it and made it dynamic. This is how I edited the function which was using the waitForSerialData() at line 206: int sendBytes(const char *bytes, int count, int resp) uint8_t* data = (uint8_t*)malloc(resp * sizeof(uint8_t*)); int rxBytes = uart_read_bytes(UART_CONTROLLER, data, UART_BUF_SIZE, 1000 / portTICK_RATE_MS); if (rxBytes > 0 ) Similar changes you may need to make wherever this function is being used. I hope this information helps you. Thank you |
Just a tip, my 2 cents: I've encountered this issue on a NUCLEO STM32G431. In my case the ESP board could not reset the STM and this led to a SYNC error just as described in this thread. Even manually grounding the NRST pin the STM refused to reset. I ended up turning off and on the NUCLEO prior to the flash procedure, and then successfully flashed the firmware. |
Do we have to install some bootloader in STM32 MCU(I am using F103RB) to flash bin file using UART? I have tried every solution mentioned in the comments and still getting sync error / serial Timeout Error |
Solved this, I was using the wrong UART port of STM32 and boot configuration was not right |
I made it work by redefining the macro of SERIAL_TIMEOUT located in the stm_pro_mode.h to an extremely large value: It was previously defined as 5000. My hypothesis was that since the problem is the timing out of the request, then let's extend the maximum time of it and see what happens. The result was that it works, but it takes like 10 seconds to upload the code to the STM32. I'm using STM32F407 and ESP32-WROVER-B |
That's because the SerialWait function doesn't work on current master, put a gigantic number make the while() run longer despite the not working delay. My fix should improve your situation. |
@akym Long shot but did you ever get this working with the STM32F407 Discovery Board? It gets to ERASE MEMORY and has Sync Failure but then does EXTENDED ERASE MEMORY and has Sync Success. Can I assume that the Serial Timeout after the (Extended Erase Memory) Sync Success indicates I need to increase the @bjesuslopezg Serial_Timeout / apply the fix that @pinkymaxou these two suggest Here is the console output: |
For anyone who finds this and is doing a STM32F407 Discovery board Used these pins Worked perfectly for me. |
int sendBytes(const char *bytes, int count, int resp)
} After some changes in these function my code is working for STM32F401RE necleo board. |
Hi for all, I am trying to use this example, but I couldnt it successfully. I got Serial timeout error.( esp32 and stm32 could not talk successfully. ) I have tried everything, powered up stm32 and esp32 with different sources, erased stm32 flash memory with STMFlashLoader, changed up baudrate, or buttons and still got error. What could be the reason of this?
Thank you...
D (337256) : stm_flash (flashSTM:74) File name: /spiffs/blink.bin
I (337256) : stm_pro_mode (initGPIO:76) GPIO Initialized
I (337256) : stm_flash (flashSTM:83) Writing STM32 Memory
I (337256) : stm_flash (writeTask:7) Write Task
I (337256) : stm_pro_mode (resetSTM:81) Starting RESET Procedure
I (337856) : stm_pro_mode (resetSTM:88) Finished RESET Procedure
I (337856) : stm_pro_mode (cmdSync:114) SYNC
E (337896) : stm_pro_mode (sendBytes:231) Serial Timeout
I (337896) : stm_pro_mode (cmdGet:123) GET
E (337936) : stm_pro_mode (sendBytes:231) Serial Timeout
I (337936) : stm_pro_mode (cmdVersion:132) GET VERSION & READ PROTECTION STATUS
E (337976) : stm_pro_mode (sendBytes:231) Serial Timeout
I (337976) : stm_pro_mode (cmdId:141) CHECK ID
E (338016) : stm_pro_mode (sendBytes:231) Serial Timeout
I (338016) : stm_pro_mode (cmdErase:149) ERASE MEMORY
E (338056) : stm_pro_mode (sendBytes:231) Serial Timeout
I (338056) : stm_pro_mode (cmdExtErase:166) EXTENDED ERASE MEMORY
E (338096) : stm_pro_mode (sendBytes:231) Serial Timeout
I (338106) : stm_flash (writeTask:19) Writing block: 1
I (338106) : stm_pro_mode (flashPage:279) Flashing Page
I (338106) : stm_pro_mode (cmdWrite:183) WRITE MEMORY
E (338146) : stm_pro_mode (sendBytes:231) Serial Timeout
E (338186) : stm_pro_mode (sendBytes:231) Serial Timeout
E (338496) : stm_pro_mode (flashPage:318) Serial Timeout
I (338496) : stm_flash (flashSTM:92) STM32 Flashed Successfully!!!
I (338496) : stm_flash (flashSTM:95) Ending Connection
I (338496) : stm_pro_mode (resetSTM:81) Starting RESET Procedure
I (339096) : stm_pro_mode (resetSTM:88) Finished RESET Procedure
I (339096) : stm_pro_mode (endConn:98) Ending Connection
I (339096) : stm_flash (flashSTM:98) Closing file
E (339096) : FILE_SERVER_HTTP (flash_post_handler:445) Target flashing failed
The text was updated successfully, but these errors were encountered: