I have issue with pin configuration by S32DS 3.4.
I have configured the pin 1 of PORT C as GPIO output, but in the automatic created structure the direction is marked as GPIO_UNSPECIFIED_DIRECTION.
Hier is excerpt from pin_mux.c
/* clang-format off */
/*
* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
BOARD_InitPins:
- options: {callFromInitBoot: 'true', coreID: core0}
- pin_list:
- {pin_num: '1', peripheral: LPSPI1, signal: sin, pin_signal: PTD1, direction: INPUT, PE: state_0}
- {pin_num: '2', peripheral: LPSPI1, signal: 'sck, sck', pin_signal: PTD0, direction: OUTPUT, PE: state_0, PS: state_1}
- {pin_num: '3', peripheral: PORTE, signal: 'port, 11', pin_signal: PTE11, direction: OUTPUT}
- {pin_num: '22', peripheral: PORTD, signal: 'port, 7', pin_signal: PTD7, direction: INPUT, PE: state_1, PS: state_1, initValue: state_1}
- {pin_num: '23', peripheral: PORTD, signal: 'port, 6', pin_signal: PTD6, direction: OUTPUT}
- {pin_num: '28', peripheral: PORTC, signal: 'port, 16', pin_signal: PTC16, direction: OUTPUT}
- {pin_num: '30', peripheral: ADC0, signal: 'se, 12', pin_signal: PTC14}
- {pin_num: '31', peripheral: PORTB, signal: 'port, 3', pin_signal: PTB3, direction: OUTPUT}
- {pin_num: '32', peripheral: PORTB, signal: 'port, 2', pin_signal: PTB2, direction: OUTPUT}
- {pin_num: '33', peripheral: CAN0, signal: 'txd, txd', pin_signal: PTB1}
- {pin_num: '34', peripheral: CAN0, signal: 'rxd, rxd', pin_signal: PTB0}
- {pin_num: '37', peripheral: ADC0, signal: 'se, 3', pin_signal: PTA7}
- {pin_num: '38', peripheral: ADC0, signal: 'se, 2', pin_signal: PTA6}
- {pin_num: '42', peripheral: CAN2, signal: 'txd, txd', pin_signal: PTB13}
- {pin_num: '43', peripheral: CAN2, signal: 'rxd, rxd', pin_signal: PTB12}
- {pin_num: '46', peripheral: PORTD, signal: 'port, 2', pin_signal: PTD2, direction: OUTPUT}
- {pin_num: '47', peripheral: LPI2C0, signal: 'scl, scl', pin_signal: PTA3, PS: state_1}
- {pin_num: '48', peripheral: LPI2C0, signal: 'sda, sda', pin_signal: PTA2, PS: state_1}
- {pin_num: '51', peripheral: LPUART1, signal: txd, pin_signal: PTC7, direction: OUTPUT}
- {pin_num: '52', peripheral: LPUART1, signal: rxd, pin_signal: PTC6, PE: state_0, PS: state_0}
- {pin_num: '54', peripheral: PORTE, signal: 'port, 2', pin_signal: PTE2, direction: OUTPUT, PE: state_0, PS: state_1}
- {pin_num: '55', peripheral: CAN1, signal: 'txd, txd', pin_signal: PTA13}
- {pin_num: '56', peripheral: CAN1, signal: 'rxd, rxd', pin_signal: PTA12}
- {pin_num: '57', peripheral: PORTA, signal: 'port, 11', pin_signal: PTA11, direction: OUTPUT, PS: state_1}
- {pin_num: '59', peripheral: PORTE, signal: 'port, 1', pin_signal: PTE1, direction: OUTPUT}
- {pin_num: '60', peripheral: LPSPI1, signal: sout, pin_signal: PTE0, direction: OUTPUT, PE: state_0, DSE: state_1}
- {pin_num: '64', peripheral: SWD, signal: dio, pin_signal: PTA4}
- {pin_num: '25', peripheral: PORTC, signal: 'port, 1', pin_signal: PTC1, direction: OUTPUT}
* BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS ***********
*/
/* clang-format on */
And the excerpt from structure
{
.base = PORTC,
.pinPortIdx = 1U,
.pullConfig = PORT_INTERNAL_PULL_NOT_ENABLED,
.driveSelect = PORT_LOW_DRIVE_STRENGTH,
.passiveFilter = false,
.mux = PORT_MUX_AS_GPIO,
.pinLock = false,
.intConfig = PORT_DMA_INT_DISABLED,
.clearIntFlag = false,
.gpioBase = PTC,
.direction = GPIO_UNSPECIFIED_DIRECTION,
.digitalFilter = false,
.initValue = 0U,
},
MCU: S32K146
SDK Version 4.0.2
Hi @DenisT1980,
I can't reproduce the issue.
When I create a project from example,
hello_world_s32k146
PTC1 is a GPIO output by default
the pin_mux.c file is generated correctly:
Can you test it with that example?
Do you use Linux?
Thanks,
BR, Daniel
I have made my own research. As I have understood the fault occurs, if the pin is configured for more than one functional group.
I have created the test project from example „hello world“, as you described. The pin configuration in functional group „BOARD_InitPins“ was OK. Then I have created the new pins functional group „TestFuncGroup“ and configured for this group the PORTC1 as ADC channel 9. Now is the configuration for PORTC1 in BOARD_InitPins wrong.
Hello @DenisT1980,
I juts tried to reproduce it, but it gives me an error that the pin is already configured in the default BOARD_InitPins function group.
BR, Daniel
Please, check if both functional group are marked as "Called by default initialization function". Select only one function group.
Hello @DenisT1980,
You are right, PTC1 has GPIO_UNSPECIFIED_DIRECTION in Arr0
But if I move the second group up like this:
It seems to be good,
Regards,
Daniel
But this make all my GPIO pins to OUTPUT, also such that are configured as INPUT!.