Skip to content
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

Ch32V003: Please allow setting option byte register from within the IDE #68

Open
FPGA-Computer opened this issue Sep 4, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@FPGA-Computer
Copy link

CH32V003 Option Bytes Register (FLASH_OBR) uses the default setting whenever code is downloaded from the compiler/Debugger environment. There doesn't seem to be a way of changing the default values from within the IDE. External WCH utility could be used, BUT the debugger will rewrite it with the default values.

e.g. PD7 is default as NRST pin. This pin could also be used as a GPIO. However, there are no IDE options to tell the Debugger to use a different Option Byte value whenever it downloads a new firmware. The only alternative is the firmware programmatically reprogram the option byte register as part of the user firmware. However, I have not tested if the changes would affects the GPIO directly without a reset.

image

@maxgerhardt
Copy link
Member

It shouldn't happen at all that a regular upload with OpenOCD or wlink or whatever touches the option bytes of the board. With what platformio.ini is it? How do you verify that the option bytes have changed?

@FPGA-Computer
Copy link
Author

FPGA-Computer commented Sep 10, 2024

My picture is a composite of screen shots - left is from within debugger, top is user manual and bottom is drop down menu from WCH utility showing the various options available.

How do you verify that the option bytes have changed?

Left side of my picture shows the FLASH_OBR register viewed within the Debugger. It shows the bit fields for RST_MODE that is different than what I programmed in from WCH-Link Utility.

As I debug my code, the IDE downloads a new copy of the firmware. Since there are no settings available within the IDE, it picks whatever the default state is or whatever the erased state.

With what platformio.ini

Is there a setting in there I can change that the Option byte that tells the debugger to program it differently? This is what I am asking for. If there is a way of doing so, then please share the steps.

it shouldn't happen at al

Well, if it happens, then it becomes an issue for someone to fix.

@maxgerhardt maxgerhardt added the bug Something isn't working label Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants