cancel
Showing results for 
Search instead for 
Did you mean: 

Why is I2C1 clock (PB6) also appearing on PA6? (L412KB)

Legacy member
Not applicable

I'm talking to a camera device on I2C1. That is working fine. I read back the data via DMA on a scan signal. This also works fine except for one bit, D6, mapped to GPIO PA6. If the output pin from the camera is connected to PA6, I2C1 stops working. Further investigation shows that PA6 is being driven with the same signal as PB6, which is I2C1's clock. In my debug, nothing is connected to PB6, PA6, but I still see the clock appear on PA6. See image below. PA6 is an input, with an internal pullup. PB6 also has an internal pullup.

Again, there is nothing connected to these pins except the logic analyzer. The signals are too wide to be glitches, they are driven. There isn't a single reference to PA6 in the entire reference manual (RM0394, ctrl-f pdf search) so I'm a bit confused.

0693W00000LysgoQAB.png

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

> I'm assuming nothing else is connected: 

No need to assume here.

Measure the resistance between what you're calling PA6 and what you're calling PB6 with the chip unpowered. It's probably ~0. So open the schematic and search for PA6.

0693W00000LyspMQAR.pngNotice SB16 is connecting PA6 and PB6. Search the user manual for SB16. Notice default state is ON. Mystery solved.

0693W00000LyspbQAB.png

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

10 REPLIES 10

> In my debug, nothing is connected to PB6, PA6

How do you know? Have you looked at the schematics, or did you actually measure resistance between these two pins? How is PA6 set? Read out and check/post GPIOA and GPIOB registers content. And what happens if you write a minimal program, which only sets PB6 as GPIO Out and then toggles it basic blinky style?

JW

Legacy member
Not applicable

Hello again @Community member​,

Thanks for replying.

I'm assuming nothing else is connected: the chip is on a Nucleo-32 board. The board is sitting on my bench with nothing connected but the USB and the logic analyzer. However I guess there could be a short on the board, it didn't occur to me.

Weird! If I make a dummy program and toggle just PB6, PA6 also toggles.

GPIOA:

0693W00000LysnGQAR.pngGPIOB:

0693W00000LysnQQAR.png 

I'm not seeing anything unusual here? Here is the init code...

static void MX_GPIO_Init(void)

{

 GPIO_InitTypeDef GPIO_InitStruct = {0};

 /* GPIO Ports Clock Enable */

 __HAL_RCC_GPIOC_CLK_ENABLE();

 __HAL_RCC_GPIOA_CLK_ENABLE();

 __HAL_RCC_GPIOB_CLK_ENABLE();

 /*Configure GPIO pin Output Level */

 HAL_GPIO_WritePin(GPIOB, LD3_Pin|GPIO_PIN_6, GPIO_PIN_RESET);

 /*Configure GPIO pin : PA6 */

 GPIO_InitStruct.Pin = GPIO_PIN_6;

 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

 /*Configure GPIO pins : LD3_Pin PB6 */

 GPIO_InitStruct.Pin = LD3_Pin|GPIO_PIN_6;

 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

}

Legacy member
Not applicable

Even if I don't initialize PA6 in CubeMX, it still toggles. That's just weird.

Legacy member
Not applicable

And if I define PA6 as an output, PB6 doesn't toggle. Am I missing something painfully obvious here?

Andreas Bolsch
Lead II

Well, you didn't read section 6.10 in UM1956, did you? SB16 !!!

TDK
Guru

> I'm assuming nothing else is connected: 

No need to assume here.

Measure the resistance between what you're calling PA6 and what you're calling PB6 with the chip unpowered. It's probably ~0. So open the schematic and search for PA6.

0693W00000LyspMQAR.pngNotice SB16 is connecting PA6 and PB6. Search the user manual for SB16. Notice default state is ON. Mystery solved.

0693W00000LyspbQAB.png

If you feel a post has answered your question, please click "Accept as Solution".

I've asked:

> Have you looked at the schematics, or did you actually measure resistance between these two pins?

http://efton.sk/STM32/gotcha/g46.html

JW

Legacy member
Not applicable

@TDK​ 

/facepalm/. Reference Manual != User Manual. Thanks!

No worries.
Reference manual is the most comprehensive and should be the primary reference.
Datasheet is for chip-specific things.
User manual is for board-specific things and is typically quite comprehensive for ST boards.
If you feel a post has answered your question, please click "Accept as Solution".