2018-04-18 05:11 AM
Hello all,
In STM32L432KB, I want to use PH3 pin as GPIO, instead of BOOT0 without affecting its boot sequence.
How should I achieve it ?Solved! Go to Solution.
2018-04-19 10:53 AM
Hello Maunik,
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:
...\STM32Cube_FW_L4_V1.10.0\Projects\STM32L476G_EVAL\Examples\FLASH\FLASH_WriteProtection
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.
Regards
Szymon
2018-04-18 07:41 AM
>>
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.
2018-04-18 03:42 PM
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.
JW
2018-04-19 01:26 AM
Hello waclawek.jan,
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 Patel2018-04-19 03:27 AM
Sorry, I don't use the 'L43x.
JW
2018-04-19 08:14 AM
Hello waclawek.jan,
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 Patel2018-04-19 10:53 AM
Hello Maunik,
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:
...\STM32Cube_FW_L4_V1.10.0\Projects\STM32L476G_EVAL\Examples\FLASH\FLASH_WriteProtection
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.
Regards
Szymon
2018-04-20 07:00 AM
Hello
Szymon,
You made my day.
I used the 2nd option (usingSTM32Cube 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