Skip to content

STM32F030C8 pinmap is missinf PF6 and PF7 as I2C pins #31

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

Closed
ghent360 opened this issue Dec 26, 2018 · 4 comments
Closed

STM32F030C8 pinmap is missinf PF6 and PF7 as I2C pins #31

ghent360 opened this issue Dec 26, 2018 · 4 comments
Assignees

Comments

@ghent360
Copy link

Hi,

The generated pinmap for the STM32F030C8 chip has only PB pins as available for I2C. In the STM32CubeMX software I can select pins 35 and 36 (PF6 and PF7) as SCL and SDA for the I2C2 module.

The generated code for the GPIO init is:
__HAL_RCC_GPIOF_CLK_ENABLE();
/**I2C2 GPIO Configuration
PF6 ------> I2C2_SCL
PF7 ------> I2C2_SDA
*/
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);

/* I2C2 clock enable */
__HAL_RCC_I2C2_CLK_ENABLE();

It is a bit odd, because there is no GPIO_InitStruct.Alternate. There is also no mention for PF6 and PF7 in the datasheet :-(.

@fpistm
Copy link
Member

fpistm commented Dec 27, 2018

From datasheet: https://www.st.com/resource/en/datasheet/stm32f030c8.pdf

image
image

The genpinmap script used to generate PeripheralPins.c parse xml from STM32CubeMX.
In the xml:

	<Pin Name="PF6" Position="35" Type="I/O">
		<Signal Name="I2C2_SCL"/>
		<Signal IOModes="Input,Output,Analog,EXTI" Name="GPIO"/>
	</Pin>
	<Pin Name="PF7" Position="36" Type="I/O">
		<Signal Name="I2C2_SDA"/>
		<Signal IOModes="Input,Output,Analog,EXTI" Name="GPIO"/>
	</Pin>

But not AF linked to this in GPIO xml file, that's why they are not present. When no AF is found the pin is ignored. So there is an issue with those pins definition, because I guess with CubeMX code this is not working? Did you try to use those pins for I2C ?
I saw in your PR that you added them manually with an AF? Are they working ?
I tried those pins with Disco F030R8 and it works fine regardless of AF defined.

If yes, the best way is to mention that it was added manually in the variant.
The PeripheralPins.c are generated so while the xml are not corrected this could not be corrected in those files. I will raise internally to see how to handle this properly.

@fpistm fpistm self-assigned this Jan 2, 2019
fpistm added a commit to fpistm/Arduino_Core_STM32 that referenced this issue Jan 3, 2019
Some pin does not have AF defined,
PinMap use GPIO_AF_NONE to identify them.

See stm32duino/Arduino_Tools#31

Signed-off-by: Frederic.Pillon <[email protected]>
fpistm added a commit to fpistm/Arduino_Tools that referenced this issue Jan 3, 2019
Fix stm32duino#31

Signed-off-by: Frederic.Pillon <[email protected]>
fpistm added a commit to fpistm/Arduino_Tools that referenced this issue Jan 4, 2019
Fix stm32duino#31

Signed-off-by: Frederic.Pillon <[email protected]>
fpistm added a commit to fpistm/Arduino_Core_STM32 that referenced this issue Jan 4, 2019
Some pin does not have AF defined,
PinMap use GPIO_AF_NONE to identify them.

See stm32duino/Arduino_Tools#31

Signed-off-by: Frederic.Pillon <[email protected]>
fpistm added a commit to stm32duino/Arduino_Core_STM32 that referenced this issue Jan 4, 2019
Some pin does not have AF defined,
PinMap use GPIO_AF_NONE to identify them.

See stm32duino/Arduino_Tools#31

Signed-off-by: Frederic.Pillon <[email protected]>
@fpistm fpistm mentioned this issue Jan 4, 2019
@fpistm
Copy link
Member

fpistm commented Jan 4, 2019

@ghent360
I've made an update of the script, now all pins are referenced. If no AF is linked then set GPIO_AFIO_NONE is set.

@ghent360
Copy link
Author

ghent360 commented Jan 5, 2019

Thank you for the diligent work.

@ghent360 ghent360 closed this as completed Jan 5, 2019
@fpistm
Copy link
Member

fpistm commented Jan 6, 2019

welcome

benwaffle pushed a commit to benwaffle/Arduino_Core_STM32 that referenced this issue Apr 10, 2019
Some pin does not have AF defined,
PinMap use GPIO_AF_NONE to identify them.

See stm32duino/Arduino_Tools#31

Signed-off-by: Frederic.Pillon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants