2020-05-08 03:14 AM
Hello everyone!
I am trying to read sensor data from an FSR402 using a STM32WB55CG in DMA with a temperature sensor as well.
For now I am mostly focusing on the FSR to also make the conversion from voltage to newtons.
After implementing the code for the conversion the programmed stopped working saying this:
Program received signal SIGTRAP, Trace/breakpoint trap.
HardFault_Handler () at ../Core/Src/stm32wbxx_it.c:84
84 {
I really don't know how to deal with all of this. I have already read something about the GDB server which I have never used as this would be my first time doing this type of project. However I notice that for the GDB I would need some connector that I do not have.
I will also attach a photo of my code where I am doing the conversion for the sensor.
/* USER CODE BEGIN 0 */
uint32_t ADC_BUFF[2], val[2], temperature, fsrResistance, fsrConductance, fsrForce;
float vsense = 3.3/4096;
float resistor = 10000;
float voltageIN = 3300;
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc){
for(int i =0; i<2; i++){
val[i] = ADC_BUFF[i];
}
temperature = ((ADC_BUFF[1] * vsense - 0.76)/ 0.0025) + 25;
fsrResistance = ((voltageIN - ADC_BUFF[0])*resistor)/ADC_BUFF[0]; // Ohms
fsrConductance = 1000000/fsrResistance; //microOhms
if(fsrConductance <= 1000){
fsrForce = fsrConductance/80;
} else{
fsrForce = fsrConductance - 1000;
fsrForce /= 30;
}
HAL_Delay(1000); // DELAY OF 1 SECOND
}
/* USER CODE END 0 */
If you guys had any idea how I could solve this, I would be really grateful!
2020-05-08 12:53 PM
> GDB server which I have never used
You are already using it - look at the bottom line at your call stack window... ;)
Hard faults can also be debugged: http://www.keil.com/appnotes/files/apnt209.pdf
fsrResistance = ((voltageIN - ADC_BUFF[0])*resistor)/ADC_BUFF[0]; // Ohms
fsrConductance = 1000000/fsrResistance; //microOhms
Both of these lines can get into division by zero, which probably is your problem.
2020-05-10 02:06 AM
Thanks for the answer! I managed to solve the problem after all!
2020-07-29 08:26 AM
Hi BNist.1, could you please tell me how to solve this problem ?
2020-08-14 04:14 AM
I guess he simply checks if the divider is zero.
if (fsrResidance) ...
2023-11-06 10:23 PM
please give the solution of this problem. i urgently need this.
2023-11-13 07:48 AM
Hi @Madhav ,
Original post started on 2020. I'm not sure if you have the same issue/symptoms/conditions...
Could you please start a new thread where you describe with details your current situation?
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.