Skip to content

Fix STM32 remapped GPIO data #47

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

Merged
merged 2 commits into from
Sep 16, 2020
Merged

Conversation

salkinium
Copy link
Member

The remapped pins were duplicated inside the GPIO list, which lead to conflicting data.
The remapped pins should only be part of the package, not the GPIO data.

@salkinium salkinium merged commit c30fc28 into modm-io:develop Sep 16, 2020
@salkinium salkinium deleted the fix/stm32 branch September 16, 2020 17:10
@chris-durand
Copy link
Member

chris-durand commented Sep 16, 2020

The remapped pins should only be part of the package, not the GPIO data.

Is this really what we want? We would like to have a gpio_A11.hpp header generated even when it is a remap pin. An STM32F042F6 has a Pin A11 with all the associated hardware functions although it is not always physically accessible on the package. This is exactly what the device file should describe, which hardware is present. Now we have to add some additional complexity inside the gpio driver to add them back in the modm driver lbuild file.

@salkinium
Copy link
Member Author

Ah, I may have misunderstood something here, let me check the raw data.

@salkinium
Copy link
Member Author

Yeah, I think your right. This is wrong, because the GPIOs are filtered by the package id, and now I've just removed them.

There is an issue with the merging algorithm, which doesn't work correctly in some complex cases where just one device has something, and the other do not.

@salkinium
Copy link
Member Author

I can revert these changes, but then it's just broken in other ways, so I guess I have to fix this merging issue, which is completely unrelated. This issue is also holding up #35.

@salkinium
Copy link
Member Author

salkinium commented Sep 16, 2020

Ah, no this is an issue in the raw data, there are simply multiple PA9 pins on different pin positions at the same time? (from STM32G071K(6-8-B)Tx.xml)

	<Pin Name="PA9" Position="19" Type="I/O">
		<Signal Name="DAC1_EXTI9"/>
		<Signal Name="I2C1_SCL"/>
		<Signal Name="RCC_MCO"/>
		<Signal Name="SPI2_MISO"/>
		<Signal Name="TIM15_BK"/>
		<Signal Name="TIM1_CH2"/>
		<Signal Name="UCPD1_DBCC1"/>
		<Signal Name="USART1_TX"/>
		<Signal IOModes="Input,Output,Analog,EVENTOUT,EXTI" Name="GPIO"/>
	</Pin>
	<Pin Name="UCPD1_DBCC1" Position="19" Type="MonoIO" Variant="PINREMAP">
		<Signal Name="UCPD1_DBCC1"/>
	</Pin>
	<Pin Name="PA10" Position="21" Type="I/O">
		<Signal Name="I2C1_SDA"/>
		<Signal Name="SPI2_MOSI"/>
		<Signal Name="TIM17_BK"/>
		<Signal Name="TIM1_CH3"/>
		<Signal Name="UCPD1_DBCC2"/>
		<Signal Name="USART1_RX"/>
		<Signal IOModes="Input,Output,Analog,EVENTOUT,EXTI" Name="GPIO"/>
	</Pin>
	<Pin Name="UCPD1_DBCC2" Position="21" Type="MonoIO" Variant="PINREMAP_10_12">
		<Signal Name="UCPD1_DBCC2"/>
	</Pin>
	<Pin Name="PA11 [PA9]" Position="22" Type="I/O">
		<Signal Name="ADC1_EXTI11"/>
		<Signal Name="COMP1_OUT"/>
		<Signal Name="I2C2_SCL"/>
		<Signal Name="I2S1_MCK"/>
		<Signal Name="SPI1_MISO"/>
		<Signal Name="TIM1_BK2"/>
		<Signal Name="TIM1_CH4"/>
		<Signal Name="USART1_CTS"/>
		<Signal Name="USART1_NSS"/>
		<Signal IOModes="Input,Output,Analog,EXTI" Name="GPIO"/>
	</Pin>
	<Pin Name="PA9 [PA11]" Position="22" Type="I/O" Variant="PINREMAP">
		<Signal Name="DAC1_EXTI9"/>
		<Signal Name="I2C1_SCL"/>
		<Signal Name="RCC_MCO"/>
		<Signal Name="SPI2_MISO"/>
		<Signal Name="TIM15_BK"/>
		<Signal Name="TIM1_CH2"/>
		<Signal Name="USART1_TX"/>
		<Signal IOModes="Input,Output,Analog,EVENTOUT,EXTI" Name="GPIO"/>
	</Pin>
	<Pin Name="PA12 [PA10]" Position="23" Type="I/O">
		<Signal Name="COMP2_OUT"/>
		<Signal Name="I2C2_SDA"/>
		<Signal Name="I2S1_SD"/>
		<Signal Name="I2S_CKIN"/>
		<Signal Name="SPI1_MOSI"/>
		<Signal Name="TIM1_ETR"/>
		<Signal Name="USART1_CK"/>
		<Signal Name="USART1_DE"/>
		<Signal Name="USART1_RTS"/>
		<Signal IOModes="Input,Output,Analog,EXTI" Name="GPIO"/>
	</Pin>
	<Pin Name="PA10 [PA12]" Position="23" Type="I/O" Variant="PINREMAP_10_12">
		<Signal Name="I2C1_SDA"/>
		<Signal Name="SPI2_MOSI"/>
		<Signal Name="TIM17_BK"/>
		<Signal Name="TIM1_CH3"/>
		<Signal Name="USART1_RX"/>
		<Signal IOModes="Input,Output,Analog,EVENTOUT,EXTI" Name="GPIO"/>
	</Pin>

@salkinium
Copy link
Member Author

Whyyyy, ST?!?

@salkinium
Copy link
Member Author

What I think ST means here, is that when you remap these pins:

  • Pos. 19 is connected to the UCPD1_DBCC1 alternate function.
  • Pos. 21 is connected to the UCPD1_DBCC2 alternate function.
  • Pos. 22 is connected to PA9, but without the UCPD1_DBCC1 AF.
  • Pos. 23 is connected to PA10, but without the UCPD1_DBCC2 AF.

BUT, there seems to additionally be some kind of variant dependency as well:

The devices housed in 64- and 48-pin packages provide 2-port USB-C Power Delivery. The devices housed in 28/32-pin packages come in two variants - “GP” with a single-port limited USB-C Power Delivery and “PD” with 2-port USB-C Power Delivery.

@chris-durand
Copy link
Member

UCPD1_DBCC1 is not an alternate function, it's an additional function. The mux control works differently. It's not in the alternate function list:

image

Haven't figured out yet how to configure it, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants