Comments (25)
Is there anyone got same error?
from ota_update_stm32_using_esp32.
Hello, @muhambykar
Can you check the GPIOs that you are using as Rx and Tx?
from ota_update_stm32_using_esp32.
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?
from ota_update_stm32_using_esp32.
Is there anybody got same error?
from ota_update_stm32_using_esp32.
Hello, @muhambykar
Sorry for the late reply.
- Test this example for UART - UART Async Tasks
- Verify whether your STM32 is in BOOT mode before flashing.
- Try resetting your STM32 using the RESET switch on your board, and then running the example. (Time it appropriately)
from ota_update_stm32_using_esp32.
Hello there, I found the solution. on ESP-IDF v4.0.x ,
uart_set_rts(UART_CONTROLLER, 1);
this function changes the uart configs, and got trouble about it. After make comment it, problem is solved. This line is on components/stm_pro_mode/stm_pro_mode.c Line: 19
I have listened the received packets from UART, then I figure out it and it works. I recommend it.
from ota_update_stm32_using_esp32.
Hello there, I found the solution. on ESP-IDF v4.0.x ,
uart_set_rts(UART_CONTROLLER, 1);
this function changes the uart configs, and got trouble about it. After make comment it, problem is solved. This line is on components/stm_pro_mode/stm_pro_mode.c Line: 19I 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?
from ota_update_stm32_using_esp32.
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.
from ota_update_stm32_using_esp32.
@muhambykar I am closing the issue for now. Reopen it if you have any updates regarding the problem.
from ota_update_stm32_using_esp32.
Hey I am getting the same error and tried everything mentioned above. Was someone able to solve it?
from ota_update_stm32_using_esp32.
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?
from ota_update_stm32_using_esp32.
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:
- ESP-IDF Version (use
git describe --tags
to find out) - STM32 MCU (e.g.
STM32F103
,STM32F401
,STM32F072
, etc.)
from ota_update_stm32_using_esp32.
Hi,
Thank you for the quick response. Here are the things you requested:
1.ESP-IDF 4.3
2. STM32F407 from DISC1 board
I probed Tx,Rx of the STM32 with oscilloscope and it is transmitting some data on the Tx but ESP32 doesnt read any of that data. I have tried running the UART example as you suggested and that one works fine on UART0 and UART2. For my implementation I am using UART2 to push firmware to the STM.
here the red channel is Tx and yellow is Rx
Any help will be appreciated.
My code for reference:
from ota_update_stm32_using_esp32.
Hello there, I found the solution. on ESP-IDF v4.0.x , uart_set_rts(UART_CONTROLLER, 1); this function changes the uart configs, and got trouble about it. After make comment it, problem is solved. This line is on components/stm_pro_mode/stm_pro_mode.c Line: 19
I have listened the received packets from UART, then I figure out it and it works. I recommend it.
Hello, @akym
Sorry for the late update. I was able to reproduce this issue on ESP-IDF branch release/v4.3
with an STM32F103
. But, the above fix (suggested by @LetsControltheController) solved the issue for me. I will try reproducing with some other STM32
boards and revert back to you.
Are you resetting the board before flashing? (if you are using the on-board RESET button, you will need to time it appropriately)
from ota_update_stm32_using_esp32.
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.
from ota_update_stm32_using_esp32.
Hello, @akym
I tried the example again on an STM32F103C8
with uart_set_rts(...)
disabled and the connections mentioned in the README, but it executed successfully.
I also had an STM32F401xC
lying around so I gave it a try on that, but the example failed with the Serial Timeout
error.
- Could you try the connections as mentioned in this article? As you are working with a Discovery board, you could be needed to change the pins (
PA9
andPA10
) for USART communication. - My
STM32F401xC
board went straight into theDFU Bootloader
mode on setting theBOOT0
,BOOT1
andnRST
pins as required and was able to flash through theUSB
mode withSTM32CubeProgrammer
after that. I am still investigating how to enter theUSART Bootloader
mode on these boards, will revert back to you if I find out more.
from ota_update_stm32_using_esp32.
Hello @laukik-hase ,
Happy new year and sorry for the late reply.
- I did try the connection suggested in the link you sent and other ports from the post as well.
- I tried flashing STM32 over USART with and external FTDI, it works flawlessly with 'STM Flash Loader Demonstrator'
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.
from ota_update_stm32_using_esp32.
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)
{
sendData(TAG_STM_PRO, bytes, count);
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 )
{
if(rxBytes == resp && data[0] == ACK)
{
data[rxBytes] = 0;
logI(TAG_STM_PRO, "%s", "Sync Success");
// ESP_LOG_BUFFER_HEXDUMP(TAG_STM_PRO, data, rxBytes, ESP_LOG_INFO);
return 1;
}
else
{
logE(TAG_STM_PRO, "%s", "Sync Failure");
return 0;
}
}
else
{
logE(TAG_STM_PRO, "%s", "Serial Timeout");
return 0;
}
free(data);
return 0;
}
`
Similar changes you may need to make wherever this function is being used.
I hope this information helps you.
Thank you
from ota_update_stm32_using_esp32.
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.
from ota_update_stm32_using_esp32.
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
from ota_update_stm32_using_esp32.
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
from ota_update_stm32_using_esp32.
I made it work by redefining the macro of SERIAL_TIMEOUT located in the stm_pro_mode.h to an extremely large value:
#define SERIAL_TIMEOUT 150000000
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
from ota_update_stm32_using_esp32.
I made it work by redefining the macro of SERIAL_TIMEOUT located in the stm_pro_mode.h to an extremely large value: #define SERIAL_TIMEOUT 150000000
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.
from ota_update_stm32_using_esp32.
Related Issues (17)
- Replacing UART by RS485 HOT 2
- control BOOT0 pin from ESP HOT 2
- Port to B-L475E-IOT01A HOT 1
- URI Header too long HOT 2
- Flashing with DFU HOT 1
- Thanks for your sharing HOT 1
- Firmware Update Over The Air (FOTA) for ECU (STM32) via ESP32 (HTTP - CAN protocols)
- How can we make this work with STM32H7 baords ?
- fatal error: driver/uart.h: No such file or directory HOT 1
- Compatibility with F407
- How to build and flash using esp-idf command prompt HOT 5
- For OTA updates for AVR MCUs, you can follow this project: ESP-LINK (ESP8266 it's cheaper)
- Header fields are too long for server to interpret HOT 4
- running the project in vscode HOT 14
- flash ESP32 instead of STM32 after uploading the file to the file server HOT 3
- ESP32 can't using other Serial? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ota_update_stm32_using_esp32.