I am getting thrown into a fault ISR when I go to return from a certain function. The xPSR Exception register is reading 3, and register 0xE000ED28 is reading 0x0100, which when translated in the manual goes to an UNDEFINSTR error.
I have tried the same code on two different processors, and I am getting the same result. The function that is causing the problems is as follows:
char ack[10];
GPS_GA(ack);
if(ack[0] != '\0'){}
/**
* Turns on GPS transparency mode
* Gets the GP Accuracy tag, and pareses out the accuracy
* Turns off GPS transparency mode
*
* Puts the result in data
*
* @param data 10 character char array
*/
void GPS_GA(char* data){
char gpsResp[256];
char* acc = NULL;
char accuracy[10];
if(GPS_PassThrough(true)){
do{
getResponse_Timeout(GPS_UART_MODULE, 1000, gpsResp);
acc = strstr(gpsResp, "$GPACCURACY");
}while(acc == NULL);
int i;
for(i = 0; i < 10 && acc[i+12] != '.' && acc[i+12] != '*'; i++){
accuracy[i] = acc[i+12];
}
accuracy[i] = '\0';
while(!GPS_PassThrough(false));
strcpy(data, accuracy);
}else{
data[0] = '\0';
}
int i = 0;
i++;
}
The last 2 lines of the function are just there for a sanity check. I can put a breakpoint on i++ and I can confirm that data contains what it is supposed to and accuracy does as well. I get the fault ISR somewhere between the i++ of GPS_GA and the if statement. A breakpoint put on the if statement is never triggered.
I am using compiler TI v16.9.1.LTS. It is a custom built board based on the RGC package.
I have also tried coding the function in another way, returning an int, and got the same error. I tried changing the function name, and it worked once...