Skip to content

Commit

Permalink
IMU Fix (#1267)
Browse files Browse the repository at this point in the history
### Changelist 
Corrected the IMU pin configuration on Cube and added back the linear
acceleration transmitting.

### Testing Done
No testing done, will confirm on hardware.
  • Loading branch information
Jugveer-Sandher authored May 22, 2024
1 parent c98dcc1 commit fd15be5
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 45 deletions.
16 changes: 16 additions & 0 deletions firmware/quadruna/VC/src/app/states/app_allStates.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "app_shdnLast.h"
// io
#include "io_sbgEllipse.h"
#include "io_imu.h"

#define IGNORE_HEARTBEAT_CYCLES 3U

Expand All @@ -24,6 +25,21 @@ void app_allStates_runOnTick100Hz(void)
app_efuse_broadcast();
app_shdnLast_broadcast();

float lin_accel_x = 0;
float lin_accel_y = 0;
float lin_accel_z = 0;

bool has_lin_accel_x = io_imu_getLinearAccelerationX(&lin_accel_x);
bool has_lin_accel_y = io_imu_getLinearAccelerationY(&lin_accel_y);
bool has_lin_accel_z = io_imu_getLinearAccelerationZ(&lin_accel_z);

if (has_lin_accel_x && has_lin_accel_y && has_lin_accel_z)
{
app_canTx_VC_ImuAccelerationX_set(lin_accel_x);
app_canTx_VC_ImuAccelerationY_set(lin_accel_y);
app_canTx_VC_ImuAccelerationZ_set(lin_accel_z);
}

app_heartbeatMonitor_checkIn();

if (heartbeat_cycles <= IGNORE_HEARTBEAT_CYCLES) // TODO make this part of the heartbeat monitor
Expand Down
102 changes: 58 additions & 44 deletions firmware/quadruna/VC/src/cubemx/VC.ioc
Original file line number Diff line number Diff line change
Expand Up @@ -145,57 +145,59 @@ Mcu.Pin24=PB2
Mcu.Pin25=PE7
Mcu.Pin26=PE8
Mcu.Pin27=PE9
Mcu.Pin28=PB10
Mcu.Pin29=PB11
Mcu.Pin28=PE14
Mcu.Pin29=PE15
Mcu.Pin3=PE6
Mcu.Pin30=PB12
Mcu.Pin31=PB13
Mcu.Pin32=PB14
Mcu.Pin33=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67=PE1
Mcu.Pin68=VP_FREERTOS_VS_CMSIS_V2
Mcu.Pin69=VP_SYS_VS_tim6
Mcu.Pin60=PD5
Mcu.Pin61=PD6
Mcu.Pin62=PB3(JTDO/TRACESWO)
Mcu.Pin63=PB5
Mcu.Pin64=PB6
Mcu.Pin65=PB7
Mcu.Pin66=PB8
Mcu.Pin67=PB9
Mcu.Pin68=PE0
Mcu.Pin69=PE1
Mcu.Pin7=PH1-OSC_OUT
Mcu.Pin70=VP_TIM3_VS_ClockSourceINT
Mcu.Pin70=VP_FREERTOS_VS_CMSIS_V2
Mcu.Pin71=VP_SYS_VS_tim6
Mcu.Pin72=VP_TIM3_VS_ClockSourceINT
Mcu.Pin8=PC0
Mcu.Pin9=PC1
Mcu.PinsNb=71
Mcu.PinsNb=73
Mcu.ThirdPartyNb=0
Mcu.UserConstants=IWDG_RESET_FREQUENCY,5;TIM3_PRESCALER,8;ADC_FREQUENCY,1000;IWDG_PRESCALER,4;LSI_FREQUENCY,32000;TIMx_FREQUENCY,512000000;SBG_ELLIPSE_GPS_BAUD_RATE,460800
Mcu.UserName=STM32H733VGTx
Expand Down Expand Up @@ -438,6 +440,14 @@ PE1.GPIOParameters=GPIO_Label
PE1.GPIO_Label=FR_STBY3
PE1.Locked=true
PE1.Signal=GPIO_Output
PE14.GPIOParameters=GPIO_Label
PE14.GPIO_Label=IMU_INT1
PE14.Locked=true
PE14.Signal=GPXTI14
PE15.GPIOParameters=GPIO_Label
PE15.GPIO_Label=IMU_INT2
PE15.Locked=true
PE15.Signal=GPXTI15
PE2.GPIOParameters=GPIO_Label
PE2.GPIO_Label=INV_R_PWR_EN
PE2.Locked=true
Expand Down Expand Up @@ -603,6 +613,10 @@ SH.ADCx_INP5.0=ADC1_INP5,IN5-Single-Ended
SH.ADCx_INP5.ConfNb=1
SH.ADCx_INP7.0=ADC1_INP7,IN7-Single-Ended
SH.ADCx_INP7.ConfNb=1
SH.GPXTI14.0=GPIO_EXTI14
SH.GPXTI14.ConfNb=1
SH.GPXTI15.0=GPIO_EXTI15
SH.GPXTI15.ConfNb=1
TIM3.IPParameters=Prescaler,Period,TIM_MasterOutputTrigger
TIM3.Period=(TIMx_FREQUENCY / TIM3_PRESCALER / ADC_FREQUENCY) - 1
TIM3.Prescaler=TIM3_PRESCALER - 1
Expand Down
2 changes: 1 addition & 1 deletion firmware/quadruna/VC/src/cubemx/VC.ioc.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15993de4d12403ef80ab2505bbc78a97
1a5beaf15f149dd56ee97fe78092f8f9

0 comments on commit fd15be5

Please sign in to comment.