Ander Goya Aguirre

Arrays in struct

Discussion created by Ander Goya Aguirre on Mar 13, 2018
Latest reply on Mar 15, 2018 by Fall Guy

Hello,

i am new with lpc1549 in the om13056 board. I am using it for one of my master's project and i am having few problems.

In some part i am calculating a controller and for that i new some values, i took this part froma bigger code and it works in another microcontroller but apparently not with this one.

this is the part:

 

typedef struct{
   uint16_t KP[4];
   uint16_t KI[4];
   uint16_t KD[4];
}Regelparameter_t;

 

for(i=0; i<4; i++)
{
   Regelparameter_ptr->KP[i] = 0x0064;
   Regelparameter_ptr->KI[i] = 0x0064;
   Regelparameter_ptr->KD[i] = 0x0064;
}

The code is okay but whenthe program start to run there is an error and it jumps to this part:

 

__attribute__ ((section(".after_vectors")))
void HardFault_Handler(void)
{ while(1) {}
}

 

I have no idea to fix this because if i change this struct it will need to change everything and acording to my project i cant do it.

 

Thanks in advance.

Outcomes