Comments (13)
Hi @zfields
honestly I don't see any link with this repo. The script simply call the STM32CubeProgrammer cli.
What I suspect is the workaround used to flash properly each time is no longer OK.
(stm32duino/Arduino_Core_STM32#1511)
Which STM32CubeProgrammer version you used ?
Note that I'm always waiting feedback internally on the issue with the flash.
from arduino_tools.
Hi @zfields,
can you also tell us whether you use EEPROM library in you application ?
from arduino_tools.
I do not. This happened while I was working on testing the behavior of while (!Serial);
stm32duino/Arduino_Core_STM32#1672 (comment)
I'm using STM32CubeProgrammer v2.10.0
from arduino_tools.
Please, could you retry with the previous version you used?
My guess is the workaround (-ob nBOOT0=0 -ob nBOOT0=1) is no more working and could explain why you get this behavior.
from arduino_tools.
You mean to install the previous version of STM32CubeProgrammer? In case it is important, my older STM32CubeProgrammer was v2.9.0.
I did notice that installing software using STM32CubeProgrammer v2.10.0 directly, require me to flash the software twice before it started running on the device.
from arduino_tools.
You mean to install the previous version of STM32CubeProgrammer? In case it is important, my older STM32CubeProgrammer was v2.9.0.
Yes 😉
I did notice that installing software using STM32CubeProgrammer v2.10.0 directly, require me to flash the software twice before it started running on the device.
That is normal. This is the issue you raised some month ago: stm32duino/Arduino_Core_STM32#1495
So using directly the STM32CubeProgrammer you haven't the workaround which has been proposed in our mail exchange (-ob nBOOT0=0 -ob nBOOT0=1).
from arduino_tools.
I'll install the old STM32CubeProgrammer and test.
from arduino_tools.
It seems to play nice with v2.9.0. 🤷
However, after I switched it to v2.9.0, then it started working fine in v2.10.0 as well.
Do we know what's causing the option bytes to become invalid?
from arduino_tools.
@fpistm I am confused when you say, "That is normal." in regard to have to flash firmware two times. Could you offer an in-depth explanation as to why that is "normal"?
It seems odd to me, but obviously I don't understand it like you do.
from arduino_tools.
@fpistm I am confused when you say, "That is normal." in regard to have to flash firmware two times. Could you offer an in-depth explanation as to why that is "normal"?
Well, you told that using direclty STM32CubeProgrammer requires to flash twice time the board. I said it is normal as there is an issue with STM32L4+ serie. Remember that this issue was raised by you --> stm32duino/Arduino_Core_STM32#1495 I didn't says it is the normal behavior just you met again the issue as without using Arduino IDE upload method the workaround we deploy is not used.
from arduino_tools.
Do we know what's causing the option bytes to become invalid?
Unfortunately no. This issue is linked to STM32CubeProgrammer and not to STM32duino stuff.
One possibility is the fact we force nBoot0 OB to be write (the workaround to avoid flash twice).
So are you able to reproduce this issue? If not maybe you got an issue with previous install of the 2.10.0?
from arduino_tools.
No, I have not been able to reproduce the issue - yet. I'll leave my Notes here, in case any one else were to encounter this issue.
Recover STM32L4R5 (Swan)
Occasionally, when flashing firmware with the ST-LINK v3 using the Arduino IDE via SWD
, the Option Bytes in the FLASH registers will become invalid.
Example of invalid register values:
FLASH Registers
Register | Value |
---|---|
OPTR |
0x08000000 |
PCROP1SR |
0xFFFE0000 |
PCROP1ER |
0xFFFE0000 |
WRP1AR |
0xFF00FF00 |
WRP2AR |
0xFF00FF00 |
PCROP2SR |
0xFFFFFFFF |
PCROP2ER |
0xFFFF0000 |
WRP1BR |
0xFF00FFFF |
WRP2BR |
0xFF00FFFF |
When the Option Byte registers get into this state, the STM32L4R5 will no longer execute firmware or allow programming. Fortunately, the STM32L4R5 can be recovered using the STM32CubeProgrammer, by updating the following FLASH registers (in the [REG] tab) to the following values:
FLASH Registers
Register | Value |
---|---|
OPTR |
0xFFEF98AA |
PCROP1SR |
0xFFFFFFFF |
PCROP1ER |
0xFFFF0000 |
WRP1AR |
0xFF00FFFF |
WRP2AR |
0xFF00FFFF |
PCROP2SR |
0xFFFFFFFF |
PCROP2ER |
0xFFFF0000 |
WRP1BR |
0xFF00FFFF |
WRP2BR |
0xFF00FFFF |
After updating the option bytes, the STM32L4R5 can now be programmed using the STM32CubeProgrammer and execute firmware. However, this state is unstable and will likely be short-lived. For unknown reasons, the STM32L4R5 will return to the bad state the next time you try to flash using the Arduino IDE via SWD
.
However, if you immediately program the STM32L4R5 using the Arduino IDE via DFU
, it appears to update something else ,?other registers, perhaps?, that stabilizes the device settings. Afterward, the device can be debugged and programmed normally via SWD
again.
from arduino_tools.
I was not able to reproduce your issue.
As stated using ArduinoIDE via SWD simply call the STM32CubeProgrammer cli.
So you should be able to reproduce without Arudino using the STM32CubeProgrammer GUI or CLI.
Your note seems not inline with your previous comment about the switch to STM32CubeProgrammer version (2.10.0 --> 2.9.0 --> 2.10.0) :
However, after I switched it to v2.9.0, then it started working fine in v2.10.0 as well.
As it works on your side, I could not reproduce and it is clearly linked to the STM32CubeProgrammer. I close this one.
If you have further issue please contact your FAE which will raised an issue internally to the STM32CubeProgrammer team. Like that you will get feedback directly from expert.
from arduino_tools.
Related Issues (20)
- STM32CubeProgrammer manual install? HOT 3
- STM32_Programmer.sh not found HOT 16
- STM32_Programmer.sh not found in Ubuntu 18.04. Edited PATH, and still can't find it. HOT 11
- cp a bin fails on Catalina HOT 4
- Flashing with Arduino MCU HOT 1
- [Windows] remove maple_loader.jar usage HOT 4
- maple_loader.jar crash HOT 6
- build_opt.h HOT 1
- Windows: EXCEPTION_ACCESS_VIOLATION on recent JRE on Windows 10 HOT 2
- 2.1.0/linux/hid-flash binary on Linux does not have execute bit set HOT 5
- License missing
- [STM32CubeProg.sh] mass erase bug HOT 1
- [STM32CubeProgrammer] "-e all" does not work for STM32G031J6 (Serial method) HOT 5
- In latest ArduinoIDE 1.8.19, `stm32CubeProg.sh` claims `STM32_Programmer.sh` is not on my `PATH`. HOT 20
- stm32duino.com - impossible to read or login (Cookie Acceptance Required - no way to accept) HOT 5
- two output channels for PWM inverted problem HOT 1
- "'java' is not recognized" error with Arduino 2.0.3 and maple 2 uploader HOT 8
- 2.2.0/linux/hid-flash binary on Linux does not have execute bit set HOT 3
- Cannot upload sketch on MacOS HOT 6
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 arduino_tools.