I am using internal clock oscillator while doing following program and it get stuck at initaillising pins i dont know why
#include "sdk_project_config.h"
void delay(volatile uint32_t count) {
while (count--);
}
int main(void) {
/* Initialize Clock System */
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,
g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
PINS_DRV_Init(1,g_pin_mux_InitConfigArr0);
PINS_DRV_WritePin(led_PORT, led_pin,1U);
return 0;
}
Hi @ash123456789,
Could you share either your project or your configuration & config array for the pin mux? It should look something like this:
pin_settings_config_t g_pin_mux_InitConfigArr0[NUM_OF_CONFIGURED_PINS0] = {
{
.base = PORTC,
.pinPortIdx = 0U,
.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_OUTPUT_DIRECTION,
.digitalFilter = false,
.initValue = 0U,
},
{
.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_OUTPUT_DIRECTION,
.digitalFilter = false,
.initValue = 0U,
},
{
.base = PORTD,
.pinPortIdx = 15U,
.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 = PTD,
.direction = GPIO_OUTPUT_DIRECTION,
.digitalFilter = false,
.initValue = 0U,
},
{
.base = PORTD,
.pinPortIdx = 16U,
.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 = PTD,
.direction = GPIO_OUTPUT_DIRECTION,
.digitalFilter = false,
.initValue = 0U,
},
};
You can also refer to the existing examples for the s32k144 (such as hello_world_s32k144) which configures two LEDs (LED0 & LED1) and toggles them in the main function.
Best regards,
Julián
Hi @ash123456789,
It seems you are only initializing one pin in your function; you can replace the "1" with the generated config as "NUM_OF_CONFIGURED_PINS0".
Also, you are using the CLOCK_SYS_Init function instead of CLOCK_DRV_Init. Clock DRV init configures the clocks for the used ports. Please test the example first then try to implement your new project on top of it:
hello_world_s32k144:
int main(void)
{
status_t error;
/* Configure clocks for PORT */
error = CLOCK_DRV_Init(&clockMan1_InitConfig0);
DEV_ASSERT(error == STATUS_SUCCESS);
/* Set pins as GPIO */
error = PINS_DRV_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);
DEV_ASSERT(error == STATUS_SUCCESS);
/* Set Output value LED0 & LED1 */
PINS_DRV_SetPins(LED0_PORT, 1 << LED0_PIN);
PINS_DRV_ClearPins(LED1_PORT, 1 << LED1_PIN);
for (;;)
{
/* Insert a small delay to make the blinking visible */
delay(720000);
/* Toggle output value LED0 & LED1 */
PINS_DRV_TogglePins(LED0_PORT, 1 << LED0_PIN);
PINS_DRV_TogglePins(LED1_PORT, 1 << LED1_PIN);
}
}
Best regards,
Julián
Hi @ash123456789,
As I've said in my previous replies, please test the included example first, as it may be easier to compare the working project. I've attached it here to my reply.
Best regards,
Julián
Hi @ash123456789,
Are you using a custom board? If so, this issue may be caused by hardware design. You can follow the Hardware Design Guidelines for S32K1.
If you are using an EVB, please make sure the jumpers are in the right configuration.
Best regards,
Julián
Hi @ash123456789,
If you wish to change your clock configuration, please refer to the following community post which already explained this: S32k144 clock source change - NXP Community.
Best regards,
Julián.
Hi @ash123456789,
There are many examples in the SDK which use a different clock source. For example, the "power_mode_switch_s32k144" uses SIRC:
Best regards,
Julián