The MCUs are assembled on a boards with LCD display, powered by 5VDC and on other occasions the program has already been loaded. Boards operate correctly but I need to load a new program
Hi Juan,
I have seen this error previously and it was caused becase the part derivative did not match the part in the board, could you please make sure that the project settings and debugger configuration have the MC9S08LG16CLF part correctly configured?
Hope it helps!
Best Regards,
Carlos Mendoza
Technical Support Engineer
Hi Carlos,
I didn't get why you sent me this message ? I don't see the link with my question,
Best regards,
Alexis Capart.
This is my code, can you tell me how to handle the GPIOS :
#include <stdio.h>
#include <stdlib.h>
#include "board.h"
#include "peripherals.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "LPC54608.h"
#include "fsl_gpio.h"
#include "fsl_debug_console.h"
/* TODO: insert other include files here. */
#define DATA0 0U //input direction
#define DATA1 0U
#define BITS_MAX 100
#define WIEGAND_PULSE 300000
static unsigned char databits[32]; // nombre max de bits
static unsigned char bitCount; // Bits acquis
static unsigned int flag; // Niveau logique bas quand la data est acquise entierement
static unsigned int wiegand_count; // Decrement jusqu'a ce qu'il n,yait plus de bits manquant
static unsigned long facilityCode = 0;
static unsigned long cardCode = 0;
uint32_t CODE[BITS_MAX];
/* TODO: insert other definitions and declarations here. */
void waitForInterrupt ()
{
...
}
void data0(void)
{
for(;;)
{
data0=GPIO_ReadPinInput(GPIO,20,9);
if(data0 == 0) // interrupt when falling edge, how i do that ?
{
bitCount++;
flag = 0;
wiegand_count = WIEGAND_PULSE;
}
}
}
void data1(void)
{
for(;;)
{
data1=GPIO_ReadPinInput(GPIO,22,11);
{
databits[(bitCount)]=1;
bitCount++;
flag = 0;
wiegand_count = WIEGAND_PULSE;
}
}
}
void Affichage_code()
{
printf("%d bits recupere", bitCount);
printf(" Facility Code : %d\n", facilityCode);
printf("TagID: %d\n\r", cardCode);
return;
}
/*
@brief Application entry point.
*/
int main(void) {
/* Init board hardware. */
BOARD_InitBootPins();
BOARD_InitBootClocks();
BOARD_InitBootPeripherals();
/* Init FSL debug console. */
BOARD_InitDebugConsole();
PRINTF("Acquisition de la trame\n");
//uint32_t = result;
while(1) {
data0();
data1();
if(bitCount > 0 && flag)
{
if(bitCount == 32)
{
unsigned char i;
for (i=1; i<31;i++) // trame entiere
{
cardCode <<=1;
cardCode |= databits[i];
}
Affichage_code();
for (i=1;i<9;i++) // facility code
{
facilityCode <<=1;
facilityCode |= databits[i];
}
Affichage_code(); // UID
for (i=9;i<31;i++)
{
cardCode <<=1;
cardCode |= databits[i];
}
Affichage_code();
bitCount=0;
facilityCode=0;
cardCode=0;
for(i=0;i<32;i++)
{
databits[i]=0;
}
}
}
}
return 0 ;
}
Hi Alexis,
This was sent in response to Juan's post:
https://community.nxp.com/thread/477253
Best Regards,
Carlos Mendoza
Technical Support Engineer