Clock Frequency FRDM-KL26Z

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

Clock Frequency FRDM-KL26Z

1,919 次查看
BPR
Contributor I

Hi,

Iam using KL26Z board gpio example and flashing it into MKL16Z32VLH4 chip making necessary gpio changes. The code is getting flashed but the output gpio is getting toggled while checking with CRO/Multimeter. I found out that there is no cystal oscillator configured and hence I configured it as default system clock. But still the gpio didn't toggled. 

Do I need to change any other clock frequency in the example code? Iam unable to find what is the issue, what do you suggest?

0 项奖励
回复
8 回复数

1,698 次查看
stevediaz
Contributor I

Hello

It's possible that the issue is related to the clock configuration. Double-check the code for any other clock frequency settings and make sure they match the requirements of your MKL16Z32VLH4 chip. Additionally, verify if there are any other dependencies on external peripherals or settings that could affect the GPIO behavior. If the problem persists, consider checking the hardware connections and ensuring they are correct. If needed, consult the datasheet or reference manual for the MKL16Z32VLH4 chip to verify its clock and GPIO configuration requirements.

0 项奖励
回复

1,903 次查看
Miguel04
NXP TechSupport
NXP TechSupport

Hi @BPR 

Could you provide me more details? I'm not understanding what the problem is.

Which example are you using?

The gpio_led_output toggles the gpio.

Best Regards, Miguel.

0 项奖励
回复

1,884 次查看
BPR
Contributor I

Sorry for the typo mistake. Iam using the frdmkl26z_driver_examples_gpio_led_output example. I am using this example to flash for my device which has MKL16Z32VLH4 chip and also 8MHZ external cystal oscillator. I also made necessary pin GPIO Output pin change in the example according to my device GPIO.

The code is getting flashed but the output gpio is not getting toggled while checking with CRO/Multimeter. 

I found out that there is no cystal oscillator configured in the clock_config.c and BOARD_BOOTCLOCKRUN_CORE_CLOCK was only configured and enabled as system clock. I have tried to implement  BOARD_XTAL0_CLK_HZ in clock_config.c but still the gpio didn't toggled.

Do I need to disable BOARD_BOOTCLOCKRUN_CORE_CLOCK completely in the example code? Iam unable to find what is the issue, what do you suggest? What changes should I need to make?

or is it problem related to bimasking? I want PTC7 PIN to Toggle and hence I have configured like this

#define BOARD_LED_GPIO_PIN 7U

GPIO_TogglePinsOutput(GPIOC, 1u << BOARD_LED_GPIO_PIN);

 

0 项奖励
回复

1,859 次查看
Miguel04
NXP TechSupport
NXP TechSupport

Hi @BPR 

Could you please share with me the complete configuration you made?

This are a general steps to initialize a pin with "baremetal":

  1. Turn on the PORTn clock on the SIM_SCGCn register
  2. Asign the MUX alternative to the pin on the PORTx_PCRn register
  3. Define if it is an input or an output on the GPIOx_PDDR register

Also, you can verify that the pin is getting toggled by debugging the project and reading the value of the PDOR register of the GPIO here:

Miguel04_0-1689273728212.png

Best Regards, Miguel.

 

0 项奖励
回复

1,845 次查看
BPR
Contributor I

1. Turn on the PORTn clock on the SIM_SCGCn register

CLOCK_EnableClock(kCLOCK_PortC);                           /* Port C Clock Gate Control: Clock enabled */

2. Assign the MUX alternative to the pin on the PORTx_PCRn register

PORT_SetPinMux(PORTC, 7, kPORT_MuxAsGpio);   

3.  Define if it is an input or an output on the GPIOx_PDDR register

gpio_pin_config_t led_config = {
kGPIO_DigitalOutput, 0
};

GPIO_PinInit(GPIOC, 7, &led_config);

 

This is how I configured and while checkingusing peripherals window, I can see like this

BPR_0-1689334769875.png

 

I added breakpoints at the Toggle function and resumed but the value is zero always.

0 项奖励
回复

1,830 次查看
Miguel04
NXP TechSupport
NXP TechSupport

Hi @BPR 

I'll look into it.

However, on the image you shared with me the PDDR register has a value of 0x0 and the spected value is 0x80 (bit 7 set to 1).

Miguel04_0-1689353760174.png

Please you confirm if this isn't the issue.

Best Regards, Miguel.

 

0 项奖励
回复

1,599 次查看
BPR
Contributor I

Yes, even after setting the GPIO as output this is the issue. Till now it is not solved from my side. Anything from your side?

Please note Iam flashing this to a custom board which has 8Mhz external clock.

0 项奖励
回复

1,575 次查看
Miguel04
NXP TechSupport
NXP TechSupport

Hi @BPR 

I found this community post, which contains the trainings to Kinetis KL25Z.

Look into the MCG (Multipurpose Clock Generator Module) resources to configure the external clock for the peripheral.

Best Regards, Miguel.

0 项奖励
回复