-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accelerometer ISM330DHCX on Nucleo-IKS02A1 #28947
base: master
Are you sure you want to change the base?
Conversation
# board ID for firmware load | ||
APJ_BOARD_ID 139 | ||
|
||
# the nucleo seems to have trouble with flashing the last sector? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# the nucleo seems to have trouble with flashing the last sector? |
define STM32_HSE_BYPASS | ||
|
||
# board ID for firmware load | ||
APJ_BOARD_ID 139 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably deserves a separate board ID; this new firmware is not going to boot on a board without the IMU available... you can reserve another id in board_types.txt (above 1000)
@@ -0,0 +1,49 @@ | |||
# hw definition file for processing by chibios_hwdef.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should include
the hwdef.dat from the board this is derived from, undef APJ_BOARD_ID
and set that alone.
@@ -0,0 +1,129 @@ | |||
# hw definition file for processing by chibios_hwdef.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be includiong a base hwdef.dat
from somewhere and only updating/overriding what it needs to.
PE9 TIM1_CH1 TIM1 PWM(1) GPIO(60) | ||
PE11 TIM1_CH2 TIM1 PWM(2) GPIO(64) | ||
PB1 TIM3_CH4 TIM3 PWM(3) GPIO(47) | ||
PC8 TIM3_CH3 TIM3 PWM(4) GPIO(98) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it does a little more than act as a test-bed :-)
Vector3f accel = Vector3f(accbuf[0], -accbuf[1], -accbuf[2]); | ||
// Adjust for chip scaling to get m/s/s | ||
//accel *= ISM330DHCX_ACCELEROMETER_SCALE_M_S; | ||
float scale = 9.8f/4096.0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
float scale = 9.8f/4096.0f; | |
const float scale = 9.8f/4096.0f; |
|
||
} | ||
if (status & 0x02) { | ||
int16_t girobuf[3]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int16_t girobuf[3]; | |
int16_t gyrobuf[3]; |
if (status & 0x02) { | ||
int16_t girobuf[3]; | ||
if (_dev->read_registers(ISM330DHCX_ADDR_OUTX_L_G, (uint8_t *)girobuf, sizeof(girobuf))) { | ||
Vector3f gyro = Vector3f(girobuf[0], -girobuf[1], -girobuf[2]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vector3f gyro = Vector3f(girobuf[0], -girobuf[1], -girobuf[2]); | |
Vector3f gyro{girobuf[0], -girobuf[1], -girobuf[2]}; |
float _gyro_scale = ISM330DHCX_GYRO_SCALE_R_S; | ||
|
||
gyro *= _gyro_scale; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
float _gyro_scale = ISM330DHCX_GYRO_SCALE_R_S; | |
gyro *= _gyro_scale; | |
gyro *= ISM330DHCX_GYRO_SCALE_R_S; |
#include <AP_HAL/AP_HAL.h> | ||
|
||
#include <AP_HAL/I2CDevice.h> | ||
#include <Filter/Filter.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <Filter/Filter.h> |
What testing has this driver had? We have previously chosen not to support sensors as their results were too poor for flight - if you have some flight logs with a comparison IMU it would be nice to see them. |
Nucleo-H743ZI with installed X-Nucleo-IKS02A1 extension board. Driver for Accelerometer and Gyro ISM330DHCX