In STM32L432KB, I want to use PH3 pin as GPIO, instead of BOOT0 without affecting its boot sequence.How should I achieve it ?
nSWBOOT0 bit belongs to so called Option Bytes region of memory. It can be modified in two ways.
One solution is accessing correct address in Flash memory. You can do it by using HAL functions. Inside Cube L4 package installed on your hard drive you can find an example how to access Option Bytes. Please refer to this path:
Oher solution is to use one of PC applications: ST-Link Utility or STM32Cube Programmer. Below I attach a picture, which shows Option Bytes with highlighted nSWBOOT0.
>>How should I achieve it ?
Have an external pull-down resistor to ensure behaviour at boot, and use the pin as an OUTPUT, or if an input that it will always be low at reset.
Or clear the nSWBOOT0 option bit. See chapter 2.6 Boot configuration and 8.3.15 Using PH3 as GPIO in RM0394.
Although that technically *does* affect the boot sequence... Depending on what exactly you want to achieve.
Thank you for your valuable time.
According to the table Boot Modes in chapter 2.6 I found my current settings as below: - BOOT0 (pin PH3) = 0 - nSWBOOT0 bit = 1 - main flash empty = 0 (not sure about it as I don't know how to check it. But I'll manage it) (choosing Main Flash Memory as Boot area)
To replace it, my new settings would be: - nSWBOOT0 bit = 0 - nBOOT0 bit = 1 (Main Flash Memory as Boot area)
Will you please tell me the API for setting bits in FLASH_OPTR register ?Somehow, I can't find it.
Thank You,Maunik Patel
Sorry, I don't use the 'L43x.
Thank you for the help.I am reading more to find the way and will surely update here, if I find proper solution.Regards,Maunik Patel
You made my day. I used the 2nd option (using STM32Cube Programmer) and it just worked.Thank you very much for the easily understandable help.
Though option one (programming the FLASH) is good for deep learners, it is quite lengthy and confusing for some one who doesn't know in detail about programming the FLASH.So, I choose 2nd option, which takes no time to configure the Option Bytes. Its too easy to use.Thanks again for the help...Thanks a lot...Regards,Maunik Patel
Retrieving data ...