Hello all,
I spent a whole day with trying to get the LED-Blinky example working on my customer target Hardware without success. I read through the documentation, countless posts, tried this and that but did not find a solution which worked. Very frustrating. Hope that someone here can give me some hints.
Here is what I did:
First I downloaded and installed the LPC54004 SDK stuff in the MCUXpresso IDE. Then I set up pins, clocks and some of the peripherals. Then I took the LPC54s018 "Hello world" code example. This was recommended by NXP since that processor is pretty close to the LPC54005. I managed to compile and run/debug the "Hello world" example on my customer target Hardware and it's doing what it's supposed to do.
Then I made a copy of the project, took parts of the 54s018_led_blinky example source code and replaced some of the code of the Hello World example with it.
The debugger tells me that the systick handler is never called.
Questions:
1.) What are potential reasons that prohibit this from working ?
2.) In the clock tool, I can set the source and div ratio for the systick clock.
But the systick period is also set in the code, using
SysTick_Config(SystemCoreClock / 1000U)
Two configs ? Which one is relevant ?
Thanks for your help
Here is the rest of the code:
/*
* Copyright 2016-2023 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @file LPC54005_Project.c
* @brief Application entry point.
*/
#include <pin_mux.h>
#include <stdio.h>
#include "board.h"
#include "peripherals.h"
#include "clock_config.h"
#include "LPC54005.h"
#include "fsl_debug_console.h"
/* TODO: insert other include files here. */
/* TODO: insert other definitions and declarations here. */
/*******************************************************************************
* Definitions
******************************************************************************/
//GPIO_0_1
#define BOARD_GPIO_PORT 0U
#define BOARD_GPIO_PIN 1U
/*******************************************************************************
* Prototypes
******************************************************************************/
/*******************************************************************************
* Variables
******************************************************************************/
volatile uint32_t g_systickCounter;
/*******************************************************************************
* Code
******************************************************************************/
void SysTick_Handler(void)
{
if (g_systickCounter != 0U)
{
g_systickCounter--;
}
}
void SysTick_DelayTicks(uint32_t n)
{
g_systickCounter = n;
while (g_systickCounter != 0U)
{
}
}
/*
* @brief Application entry point.
*/
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("\r\nGPIO TOGGLE TEST\r\n");
/* Set systick reload value to generate 1ms interrupt */
if (SysTick_Config(SystemCoreClock / 1000U))
{
while (1)
{
}
}
PRINTF("SYSTICK CONFIGURED\r\n");
while (1)
{
/* Delay 1000 ms */
SysTick_DelayTicks(1000U);
GPIO_PortToggle(GPIO, BOARD_GPIO_PORT, 1u << BOARD_GPIO_PIN);
//PRINTF("GPIO toggeled\r\n");
}
}