4156 views|17 replies

2865

Posts

4

Resources
The OP
 

How to reuse the boot0 pin of stm32g431 as I2C [Copy link]

 

I used STM32CubeMX to set PB8 and PB7 as I2C pins, but the chip did not work because PB8 is the Boot0 pin by default and the circuit needs to be GND. So I used STM32 ST-LINK Utility to set it up and it can be used, but I2C has not been working properly. I don't know how else to set it up.

The above picture shows the setup project. After I set it up, I only set the PA8 pin to I2C and did not set the others. I have pulled up the I2C pin with a 4.7K resistor.

I measured that pin PB7 is high level, but PB8 is low level GND. This seems abnormal.

This post is from stm32/stm8

Latest reply

BOOT0, I feel like I'm not going to mess with you when I see this name   Details Published on 2022-12-6 00:30
 

6062

Posts

4

Resources
2
 
This post was last edited by damiaa on 2022-11-24 16:01

According to the documentation, there is no need to use PB8 after setting the configuration bits to start.

Even if PB8 selects the IO port for startup, it is an input and will not be at a low level all the time.

Have you done a simple gpio test on it, flip it and see if it works.

If possible, then look at the i2C issue.

As for BFB2: you can check it out, I haven't played it.

When the device boots from SRAM, in the application initialization code, you have to

relocate the vector table in SRAM using the NVIC exception table and the offset register.

When booting from the main Flash memory, the application software can either boot from

bank 1 or from bank 2 (only for category 3 devices). By default, boot from bank 1 is selected.

To select boot from Flash memory bank 2, set the BFB2 bit in the user option bytes. When

this bit is set and the boot pins are in the boot from main Flash memory configuration, the

device boots from system memory, and the boot loader jumps to execute the user

application programmed in Flash memory bank 2. For further details, please refer to

AN2606

This post is from stm32/stm8

Comments

I suspect it's because the pins are not initialized as I2C. I also don't know why the programs generated by the STM32G431 Cube do not specify GPIO multiplexing. The serial port, PWM, ADC, etc. are all the same, but the serial port works fine.  Details Published on 2022-11-24 17:16
I suspect it's because the pins are not initialized as I2C. I also don't know why the programs generated by the STM32G431 Cube do not specify GPIO multiplexing. The serial port, PWM, ADC, etc. are all the same, but the serial port works fine.  Details Published on 2022-11-24 16:12
 
 

2865

Posts

4

Resources
3
 
damiaa posted on 2022-11-24 15:25 According to the information, if the configuration bit is set to start, there will be no PB8. Even if PB8 is used to start the IO port, it is input, so it will not be low power all the time...

I suspect it's because the pins are not initialized as I2C. I also don't know why the programs generated by the STM32G431 Cube do not specify GPIO multiplexing. The serial port, PWM, ADC, etc. are all the same, but the serial port works fine.

This post is from stm32/stm8

Comments

It is specified. [attachimg]659747[/attachimg] The BFB2 bit seems to be used for dual boot, when users want to upgrade programs, etc. You can check the manual for details. Is it related to it?  Details Published on 2022-11-24 16:35
 
 

6062

Posts

4

Resources
4
 
bigbat posted on 2022-11-24 16:12 I suspect it is because the pin is not initialized as I2C, and I don’t know why the program generated by the STM32G431 Cube does not specify GPIO multiplexing, ...

It has been specified.

The BFB2 bit seems to be used for dual booting, when users want to upgrade programs, etc. You can check the manual for details. Is it related to it?

This post is from stm32/stm8

Comments

No matter how I set it, it is always low level. I set the PIN to output high, multiplexing mode, open drain mode. It seems that BOOT0 can't be reused. GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_7; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_  Details Published on 2022-11-24 17:06
 
 
 

6742

Posts

2

Resources
5
 

First check whether PB8 can be pulled high normally. If it can, it is probably that there is a problem in initializing IIC. You can use software IIC first.

This post is from stm32/stm8
 
 
 

2865

Posts

4

Resources
6
 
damiaa posted on 2022-11-24 16:35 It is specified. The BFB2 bit seems to be used for dual boot, and users need to upgrade programs and other scenarios. Please check the manual for details. Is it not...

No matter how I set it, it is always low level. I set the PIN to output high, multiplexing mode, open drain mode. It is always low. It seems that BOOT0 cannot be reused.

	GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_7;
	GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
	GPIO_InitStruct.Pull = GPIO_NOPULL;
	GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
	HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

This post is from stm32/stm8

Comments

Have you seen BFB2?  Details Published on 2022-11-24 17:14
 
 
 

6062

Posts

4

Resources
7
 
This post was last edited by damiaa on 2022-11-24 17:16

Have you looked at the BFB2 in the STM32 ST-LINK Utility settings? However, I have never used this board and have never played with BFB2. You can look at it yourself. Explore it.

This post is from stm32/stm8
 
 
 

2865

Posts

4

Resources
8
 
damiaa posted on 2022-11-24 15:25 According to the information, if the configuration bit is set to start, there will be no PB8. Even if PB8 is used to start the IO port, it is input, so it will not be low power all the time...

BFB2 seems to have nothing to do with BOOT0. The documentation says that nSWBOOT0 of the G4 series is used to determine whether the BOOT0 signal source is internal or external. If it is internal boot0, it is determined by nBoot0.

This post is from stm32/stm8
 
 
 

6062

Posts

4

Resources
9
 
This post was last edited by damiaa on 2022-11-25 11:15

Is this selected? It seems that it is not selected in the picture. When nBOOT_SEL is 1 , the boot mode is completely controlled by Option Bytes.

It should be reusable. ST is not that low.

Only STM32G series can boot from boot0 controlled by Option Bytes. I checked F0 series and found that this function is not available yet.

This post is from stm32/stm8

Comments

nBOOT_SEL is not selectable. The manual DataSheet says that nSWBOOT0 is used to control it. Is this the same as nBOOT_SEL?  Details Published on 2022-11-25 11:51
 
 
 

2865

Posts

4

Resources
10
 
damiaa posted on 2022-11-25 11:12 Is this selected? It seems that it is not selected in the picture. When nBOOT_SEL is 1, the boot mode is completely controlled by Option Bytes. In theory, it is...

nBOOT_SEL is not selectable. The manual DataSheet says that nSWBOOT0 is used to control it. Is this the same as nBOOT_SEL?

This post is from stm32/stm8

Comments

Indeed, the manual says Flash option register (FLASH_OPTR) Bit 26 nSWBOOT0: Software BOOT0 0: BOOT0 taken from the option bit nBOOT0 1: BOOT0 taken from PB8/BOOT0 pin I'll find it for you when I have time.  Details Published on 2022-11-25 12:42
 
 
 

6062

Posts

4

Resources
11
 
This post was last edited by damiaa on 2022-11-25 12:58
bigbat posted on 2022-11-25 11:51 nBOOT_SEL is not selectable. The manual DataSheet says that nSWBOOT0 is used to control it. Does this have the same function as nBOOT_SEL?

It is true that different models are different. The STM32G4 reference manual says

Flash option register (FLASH_OPTR)

Bit 26 nSWBOOT0: Software BOOT0

0: BOOT0 taken from the option bit nBOOT0

1: BOOT0 taken from PB8/BOOT0 pin

When I have time, I will find a stm32g series board to try.

Is it a self-made board or an official development board? Have you measured the hardware? For example, are PB8 and gnd short-circuited?

This post is from stm32/stm8

Comments

There is no short circuit between PB8 and GND, and there is no cold soldering phenomenon, but PB8 does not work no matter how I set it. This puzzles me. I made the board myself, and there are no extra pins, otherwise I would not use pins like PB8. Another phenomenon is that PA15, the native pin of I2C  Details Published on 2022-11-25 13:47
 
 
 

2865

Posts

4

Resources
12
 

There is no short circuit between PB8 and GND, and there is no cold soldering, but PB8 does not work no matter how I set it. This puzzles me. I made the board myself, and there are no extra pins, otherwise I would not use pins like PB8.

There is another phenomenon, that is, PA15, which is the native pin of I2C, is connected to BELL, and sometimes the buzzer sound will be smaller during debugging and loading.

This post is from stm32/stm8

Comments

PA15, the native pin of I2C, is connected to BELL? Is the driving current not enough? Try to amplify it with a transistor.  Details Published on 2022-11-25 14:36
 
 
 

6062

Posts

4

Resources
13
 

PA15, the native pin of I2C, is connected to BELL? Is the driving current not enough? Try to amplify it with a transistor.

This post is from stm32/stm8

Comments

PA15 is connected to the optocoupler and then works after isolation. Therefore, it does not affect the driving of PA15. Most of the time, BELL is normal. It is only during debugging that the sound is low after loading.  Details Published on 2022-11-25 15:47
 
 
 

2865

Posts

4

Resources
14
 
damiaa posted on 2022-11-25 14:36 PA15, which is the native pin of I2C, is connected to BELL? Is the driving current not enough? Try to amplify it with a transistor.

PA15 is connected to the optocoupler and then works after isolation. Therefore, it does not affect the driving of PA15. Most of the time, BELL is normal. It is only during debugging that the sound is low after loading.

This post is from stm32/stm8
 
 
 

6062

Posts

4

Resources
15
 

I tested a nucleo-g491re today:

For nucleo-g491re, select 1 for sWBBOOT0 and PB8-BOOT and leave it floating without grounding.

The effect is the same as sWBBOOT0 select 0 nBOOT0 select 1

Push-pull output controls pb8. PB8-BOOT is always 0.

This post is from stm32/stm8

Comments

Does that mean that PB8 cannot output push-pull? I am also frustrated that the output of PB8 is always 0 no matter what I do. Even if I adjust the pins, it still doesn't work. Is there anyone from ST in the forum who can ask what's going on?  Details Published on 2022-11-28 13:26
 
 
 

2865

Posts

4

Resources
16
 
damiaa posted on 2022-11-28 11:51 I tested a nucleo-g491re today: nucleo-g491re's sWBBOOT0 selects 1 and PB8-BOOT can also be left ungrounded and left floating. ...

Does that mean that PB8 cannot output push-pull? I am also frustrated that the output of PB8 is always 0 no matter what I do. Even if I adjust the pins, it still doesn't work. Is there anyone from ST in the forum who can ask what's going on?

This post is from stm32/stm8

Comments

It should be that nothing works because there is no pull-up resistor. Make a push-pull output to test it.  Details Published on 2022-11-28 14:21
 
 
 

6062

Posts

4

Resources
17
 
bigbat posted on 2022-11-28 13:26 Does that mean that PB8 cannot have push-pull output? I am also frustrated that the output of PB8 is always 0 no matter what I do. Even if I adjust the pins, it still doesn't work...

It should be that nothing works. Because there is no pull-up resistor. Make a push-pull output to test it. Is it like this in some versions? I see that it works everywhere.

This post is from stm32/stm8
 
 
 

224

Posts

0

Resources
18
 

BOOT0, I feel like I'm not going to mess with you when I see this name

This post is from stm32/stm8
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list