Hi Team,
I need to work with MKL16Z32VLH4.
How can we start working on it with MCUXpresso?
I have tried to select FRDM-KL26, but I am not getting MKL16Z32VLH4 on the list.
I downloaded SDK from SDK builder but don't know how to install this in MCUXpresso.
Can anyone help with this?
Thanks @Celeste_Liu for your quick response to this
I am able to create project using imported sdk, and I created led basic code which are available on my mkl16z board. when I build and flash it is not turning on the LED or toggle can you check once?
Am I missing any initialization?
Am I missing any clock configuration?
If this is done I can start developing the project with my functionalities.
I am attaching the exported code.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "board.h"
#include "peripherals.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "fsl_debug_console.h"
#include "MKL16Z4.h"
#include "fsl_gpio.h"
//TODO: insert other include files here.
//TODO: insert other definitions and declarations here.
#define LED1_PIN 16U // PTE16
#define LED2_PIN 17U // PTE17
#define LED_PORT PORTE // Port E for both LEDs
#define LED_GPIO GPIOE // GPIOE for both LEDs
void delay(void) {
for (volatile uint32_t i = 0; i < 1000000; ++i) {
__asm("NOP");
// No operation, just delays
}
}
// Function to initialize LED pins
void LED_Init(void) {
// Configuration structure for LED pins
gpio_pin_config_t led_config = { kGPIO_DigitalOutput, // Set as output
1 // Initial logic level (off)
};
// Initialize the pins for LED1 and LED2 as outputs
GPIO_PinInit(LED_GPIO, LED1_PIN, &led_config);
GPIO_PinInit(LED_GPIO, LED2_PIN, &led_config);
}
int main(void) {
// Init board hardware.
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitBootPeripherals();
/*#ifndef BOARD_INIT_DEBUG_CONSOLE_PERIPHERAL
//Init FSL debug console.
BOARD_InitDebugConsole();
#endif
PRINTF("Hello World\r\n");*/
LED_Init();
GPIO_SetPinsOutput(LED_GPIO, 1U << LED1_PIN);
GPIO_SetPinsOutput(LED_GPIO, 1U << LED2_PIN);
while (1) {
// Toggle LED1 and LED2
GPIO_TogglePinsOutput(LED_GPIO, 1U << LED1_PIN);
GPIO_TogglePinsOutput(LED_GPIO, 1U << LED2_PIN);
// Delay between toggles
delay();
}
return 0;
}
Hi @Celeste_Liu
Thanks for your response.
I tried your suggestions, selected MKL16Z32xxx4 SDK, and created the led_Output project.
But in the MCU it is still MKL26Z128xxx4. will it work on MKL16Z32 MCU?
I have to create one led working example for MKL16Z32VFM4 mcu. Later I can work on the main project implementation.
Hello ss114,
For your question, I think the answer is yes. Both Kinetis KL16 and KL26 MCUs can be used on the FRDM-KL26Z development board. You can try compiling and flashing it to see if it works.
BR,
Celeste
We don't have a reference board named MKL16Z32. We only have the MKL16Z32 chip. Did you make a custom board using this chip? Or is it some other reference board? Please let me know. It's possible that the led pin in the schematic of your board is different.
I have a custom board which is prepared using MKL16Z32VFM4 and I have the schematics also.
Do I need to configure an external crystal oscillator?
What are the steps to create a project that doesn't have a dev board?
I believe some configurations I am missing.
How can we create the project for a custom board?
Hello @ss114 ,
I think you may have missed the pins and clocks initialization for your custom boards. Regarding how to create a project for a custom board, as a suggestion, I think is better to create a project for the KL16Z and base your code in the examples from the KL26Z, with this you won't need to modify the startup code or the linker file. You can refer to the following steps:
1. Create a new C/C++ project.
2. Select the MKL16Z32xxx4 SDK, then select the required components and click Finish.
3. Use the Project Explorer menu bar to launch Config Tools, open Pins to multiplex pin signals and open Clocks to change the clock configuration.
4. Click "Update Code" to save the config settings (.mex) and generate the pin and clock source files.
5. Modify the main function and related functions, compile and debug.
Sorry, we can't help you debug because we don't have a custom board. But don't worry. If there are any problems, feel free to contact me at any time. In addition, I provide some links. I think they will be helpful to you.
USING-MCUXPRESSO-CONFIG-TOOLS-WITH-CUSTOM-HARDWARE.pdf
BRs,
Celeste
Hello @ss114 ,
Have you tried using the examples in the SDK? You can refer to the "led_output" demo among them. The opening method is as follows.
After importing, please refer to the /doc/readme.txt document first.
After flashing the compiled binary, there is no need to flash the bootloader.
BRs,
Celeste
Hello @ss114 ,
Thank you for contacting NXP Tech Support. Regarding the SDK for MKL16Z32VLH4, the SDK shown in your attached figure is exactly what you need.
As for how to download the SDK to MCUXpresso, you can refer to the following picture or Import SDK .
For more information on how to operate using MCUXpresso, you can refer to “3.2.1 Running a demo using MCUXpresso IDE” on this webpage .
If this post answers your question, please click the "ACCEPT AS SOLUTION" button. Thank you!
Best Regards,
Celeste