accessing pin getting error when i used code configure for s32k144

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

accessing pin getting error when i used code configure for s32k144

10,144 次查看
ash123456789
Contributor III

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;
}

0 项奖励
回复
12 回复数

10,102 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复

10,089 次查看
ash123456789
Contributor III

at pins drv init program counter directly  going to  default isr and showing some issue but fr bare led blink its working

0 项奖励
回复

10,066 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

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

 

0 项奖励
回复

10,035 次查看
ash123456789
Contributor III

like you said i tried and see program counter is going in defaault isr 

0 项奖励
回复

10,017 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复

10,006 次查看
ash123456789
Contributor III

I run your example on my board and there is issue in initialize clock it is getting stuck or waiting to sock clk to start but it has some issue 

0 项奖励
回复

9,984 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复

9,960 次查看
ash123456789
Contributor III
Hi, Julián_AragónM
On my custom board we r not connected in external crystal for clock, i am using internal FIRC OR LIRC as clock source do you have any reference related to this or any example code how to use ?
0 项奖励
回复

9,939 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

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.

0 项奖励
回复

9,805 次查看
ash123456789
Contributor III
give me one example which can run on internal clock with code configurator if possible share one example zip with only internal clk and any peripheral driver configure please
0 项奖励
回复

9,759 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @ash123456789,

There are many examples in the SDK which use a different clock source. For example, the "power_mode_switch_s32k144" uses SIRC:

Julin_AragnM_0-1735926967168.pngJulin_AragnM_1-1735926971492.png

Best regards,
Julián

0 项奖励
回复

10,124 次查看
ash123456789
Contributor III
its woring on bare metal by register configure but i am only getting issue at code configator
0 项奖励
回复