mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-30 11:37:06 +08:00
[messages] added field for i2c bus number to I2C_ERRORS message
This commit is contained in:
@@ -1963,6 +1963,7 @@
|
||||
<field name="smbus_alert_cnt" type="uint16"/>
|
||||
<field name="unexpected_event_cnt" type="uint16"/>
|
||||
<field name="last_unexpected_event" type="uint32"/>
|
||||
<field name="bus_number" type="uint8"/>
|
||||
</message>
|
||||
|
||||
<message name="RDYB_TRAJECTORY" id="254">
|
||||
|
||||
@@ -87,6 +87,7 @@ static inline void main_periodic_task( void ) {
|
||||
uint16_t i2c2_smbus_alert_cnt = i2c2.errors->smbus_alert_cnt;
|
||||
uint16_t i2c2_unexpected_event_cnt = i2c2.errors->unexpected_event_cnt;
|
||||
uint32_t i2c2_last_unexpected_event = i2c2.errors->last_unexpected_event;
|
||||
const uint8_t _bus2 = 2;
|
||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||
&i2c2_ack_fail_cnt,
|
||||
&i2c2_miss_start_stop_cnt,
|
||||
@@ -96,7 +97,8 @@ static inline void main_periodic_task( void ) {
|
||||
&i2c2_timeout_tlow_cnt,
|
||||
&i2c2_smbus_alert_cnt,
|
||||
&i2c2_unexpected_event_cnt,
|
||||
&i2c2_last_unexpected_event);
|
||||
&i2c2_last_unexpected_event,
|
||||
&_bus2);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ static inline void main_periodic_task( void ) {
|
||||
uint16_t i2c2_smbus_alert_cnt = i2c2.errors->smbus_alert_cnt;
|
||||
uint16_t i2c2_unexpected_event_cnt = i2c2.errors->unexpected_event_cnt;
|
||||
uint32_t i2c2_last_unexpected_event = i2c2.errors->last_unexpected_event;
|
||||
const uint8_t _bus2 = 2;
|
||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||
&i2c2_ack_fail_cnt,
|
||||
&i2c2_miss_start_stop_cnt,
|
||||
@@ -97,7 +98,8 @@ static inline void main_periodic_task( void ) {
|
||||
&i2c2_timeout_tlow_cnt,
|
||||
&i2c2_smbus_alert_cnt,
|
||||
&i2c2_unexpected_event_cnt,
|
||||
&i2c2_last_unexpected_event);
|
||||
&i2c2_last_unexpected_event,
|
||||
&_bus2);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -751,6 +751,7 @@
|
||||
uint16_t i2c0_smbus_alert_cnt = i2c0.errors->smbus_alert_cnt; \
|
||||
uint16_t i2c0_unexpected_event_cnt = i2c0.errors->unexpected_event_cnt; \
|
||||
uint32_t i2c0_last_unexpected_event = i2c0.errors->last_unexpected_event; \
|
||||
const uint8_t _bus0 = 0; \
|
||||
DOWNLINK_SEND_I2C_ERRORS(_trans, _dev, \
|
||||
&i2c0_ack_fail_cnt, \
|
||||
&i2c0_miss_start_stop_cnt, \
|
||||
@@ -760,7 +761,8 @@
|
||||
&i2c0_timeout_tlow_cnt, \
|
||||
&i2c0_smbus_alert_cnt, \
|
||||
&i2c0_unexpected_event_cnt, \
|
||||
&i2c0_last_unexpected_event); \
|
||||
&i2c0_last_unexpected_event, \
|
||||
&_bus0); \
|
||||
}
|
||||
#else
|
||||
#define PERIODIC_SEND_I2C0_ERRORS(_trans, _dev) {}
|
||||
@@ -777,6 +779,7 @@
|
||||
uint16_t i2c1_smbus_alert_cnt = i2c1.errors->smbus_alert_cnt; \
|
||||
uint16_t i2c1_unexpected_event_cnt = i2c1.errors->unexpected_event_cnt; \
|
||||
uint32_t i2c1_last_unexpected_event = i2c1.errors->last_unexpected_event; \
|
||||
const uint8_t _bus1 = 1; \
|
||||
DOWNLINK_SEND_I2C_ERRORS(_trans, _dev, \
|
||||
&i2c1_ack_fail_cnt, \
|
||||
&i2c1_miss_start_stop_cnt, \
|
||||
@@ -786,7 +789,8 @@
|
||||
&i2c1_timeout_tlow_cnt, \
|
||||
&i2c1_smbus_alert_cnt, \
|
||||
&i2c1_unexpected_event_cnt, \
|
||||
&i2c1_last_unexpected_event); \
|
||||
&i2c1_last_unexpected_event, \
|
||||
&_bus1); \
|
||||
}
|
||||
#else
|
||||
#define PERIODIC_SEND_I2C1_ERRORS(_trans, _dev) {}
|
||||
@@ -803,6 +807,7 @@
|
||||
uint16_t i2c2_smbus_alert_cnt = i2c2.errors->smbus_alert_cnt; \
|
||||
uint16_t i2c2_unexpected_event_cnt = i2c2.errors->unexpected_event_cnt; \
|
||||
uint32_t i2c2_last_unexpected_event = i2c2.errors->last_unexpected_event; \
|
||||
const uint8_t _bus2 = 2; \
|
||||
DOWNLINK_SEND_I2C_ERRORS(_trans, _dev, \
|
||||
&i2c2_ack_fail_cnt, \
|
||||
&i2c2_miss_start_stop_cnt, \
|
||||
@@ -812,7 +817,8 @@
|
||||
&i2c2_timeout_tlow_cnt, \
|
||||
&i2c2_smbus_alert_cnt, \
|
||||
&i2c2_unexpected_event_cnt, \
|
||||
&i2c2_last_unexpected_event); \
|
||||
&i2c2_last_unexpected_event, \
|
||||
&_bus2); \
|
||||
}
|
||||
#else
|
||||
#define PERIODIC_SEND_I2C2_ERRORS(_trans, _dev) {}
|
||||
|
||||
@@ -90,16 +90,27 @@ static inline void main_periodic_task( void ) {
|
||||
});
|
||||
RunOnceEvery(256,
|
||||
{
|
||||
uint16_t i2c2_ack_fail_cnt = i2c2.errors->ack_fail_cnt;
|
||||
uint16_t i2c2_miss_start_stop_cnt = i2c2.errors->miss_start_stop_cnt;
|
||||
uint16_t i2c2_arb_lost_cnt = i2c2.errors->arb_lost_cnt;
|
||||
uint16_t i2c2_over_under_cnt = i2c2.errors->over_under_cnt;
|
||||
uint16_t i2c2_pec_recep_cnt = i2c2.errors->pec_recep_cnt;
|
||||
uint16_t i2c2_timeout_tlow_cnt = i2c2.errors->timeout_tlow_cnt;
|
||||
uint16_t i2c2_smbus_alert_cnt = i2c2.errors->smbus_alert_cnt;
|
||||
uint16_t i2c2_unexpected_event_cnt = i2c2.errors->unexpected_event_cnt;
|
||||
uint32_t i2c2_last_unexpected_event = i2c2.errors->last_unexpected_event;
|
||||
const uint8_t _bus2 = 2;
|
||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||
&i2c2.errors->ack_fail_cnt,
|
||||
&i2c2.errors->miss_start_stop_cnt,
|
||||
&i2c2.errors->arb_lost_cnt,
|
||||
&i2c2.errors->over_under_cnt,
|
||||
&i2c2.errors->pec_recep_cnt,
|
||||
&i2c2.errors->timeout_tlow_cnt,
|
||||
&i2c2.errors->smbus_alert_cnt,
|
||||
&i2c2.errors->unexpected_event_cnt,
|
||||
&i2c2.errors->last_unexpected_event);
|
||||
&i2c2_ack_fail_cnt,
|
||||
&i2c2_miss_start_stop_cnt,
|
||||
&i2c2_arb_lost_cnt,
|
||||
&i2c2_over_under_cnt,
|
||||
&i2c2_pec_recep_cnt,
|
||||
&i2c2_timeout_tlow_cnt,
|
||||
&i2c2_smbus_alert_cnt,
|
||||
&i2c2_unexpected_event_cnt,
|
||||
&i2c2_last_unexpected_event,
|
||||
&_bus2);
|
||||
});
|
||||
if (mag_state == 2) send_config();
|
||||
|
||||
|
||||
@@ -86,16 +86,27 @@ static inline void main_periodic_task( void ) {
|
||||
LED_PERIODIC();
|
||||
});
|
||||
RunOnceEvery(256, {
|
||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||
&i2c2.errors->ack_fail_cnt,
|
||||
&i2c2.errors->miss_start_stop_cnt,
|
||||
&i2c2.errors->arb_lost_cnt,
|
||||
&i2c2.errors->over_under_cnt,
|
||||
&i2c2.errors->pec_recep_cnt,
|
||||
&i2c2.errors->timeout_tlow_cnt,
|
||||
&i2c2.errors->smbus_alert_cnt,
|
||||
&i2c2.errors->unexpected_event_cnt,
|
||||
&i2c2.errors->last_unexpected_event);
|
||||
uint16_t i2c2_ack_fail_cnt = i2c2.errors->ack_fail_cnt;
|
||||
uint16_t i2c2_miss_start_stop_cnt = i2c2.errors->miss_start_stop_cnt;
|
||||
uint16_t i2c2_arb_lost_cnt = i2c2.errors->arb_lost_cnt;
|
||||
uint16_t i2c2_over_under_cnt = i2c2.errors->over_under_cnt;
|
||||
uint16_t i2c2_pec_recep_cnt = i2c2.errors->pec_recep_cnt;
|
||||
uint16_t i2c2_timeout_tlow_cnt = i2c2.errors->timeout_tlow_cnt;
|
||||
uint16_t i2c2_smbus_alert_cnt = i2c2.errors->smbus_alert_cnt;
|
||||
uint16_t i2c2_unexpected_event_cnt = i2c2.errors->unexpected_event_cnt;
|
||||
uint32_t i2c2_last_unexpected_event = i2c2.errors->last_unexpected_event;
|
||||
const uint8_t _bus2 = 2;
|
||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||
&i2c2_ack_fail_cnt,
|
||||
&i2c2_miss_start_stop_cnt,
|
||||
&i2c2_arb_lost_cnt,
|
||||
&i2c2_over_under_cnt,
|
||||
&i2c2_pec_recep_cnt,
|
||||
&i2c2_timeout_tlow_cnt,
|
||||
&i2c2_smbus_alert_cnt,
|
||||
&i2c2_unexpected_event_cnt,
|
||||
&i2c2_last_unexpected_event,
|
||||
&_bus2);
|
||||
});
|
||||
|
||||
switch (gyro_state) {
|
||||
|
||||
@@ -155,16 +155,27 @@ static void test_baro_start(void) {all_led_green();}
|
||||
static void test_baro_periodic(void) {
|
||||
RunOnceEvery(2, {baro_periodic();});
|
||||
RunOnceEvery(100,{
|
||||
uint16_t i2c2_ack_fail_cnt = i2c2.errors->ack_fail_cnt;
|
||||
uint16_t i2c2_miss_start_stop_cnt = i2c2.errors->miss_start_stop_cnt;
|
||||
uint16_t i2c2_arb_lost_cnt = i2c2.errors->arb_lost_cnt;
|
||||
uint16_t i2c2_over_under_cnt = i2c2.errors->over_under_cnt;
|
||||
uint16_t i2c2_pec_recep_cnt = i2c2.errors->pec_recep_cnt;
|
||||
uint16_t i2c2_timeout_tlow_cnt = i2c2.errors->timeout_tlow_cnt;
|
||||
uint16_t i2c2_smbus_alert_cnt = i2c2.errors->smbus_alert_cnt;
|
||||
uint16_t i2c2_unexpected_event_cnt = i2c2.errors->unexpected_event_cnt;
|
||||
uint32_t i2c2_last_unexpected_event = i2c2.errors->last_unexpected_event;
|
||||
const uint8_t _bus2 = 2;
|
||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||
&i2c2.errors->ack_fail_cnt,
|
||||
&i2c2.errors->miss_start_stop_cnt,
|
||||
&i2c2.errors->arb_lost_cnt,
|
||||
&i2c2.errors->over_under_cnt,
|
||||
&i2c2.errors->pec_recep_cnt,
|
||||
&i2c2.errors->timeout_tlow_cnt,
|
||||
&i2c2.errors->smbus_alert_cnt,
|
||||
&i2c2.errors->unexpected_event_cnt,
|
||||
&i2c2.errors->last_unexpected_event);
|
||||
&i2c2_ack_fail_cnt,
|
||||
&i2c2_miss_start_stop_cnt,
|
||||
&i2c2_arb_lost_cnt,
|
||||
&i2c2_over_under_cnt,
|
||||
&i2c2_pec_recep_cnt,
|
||||
&i2c2_timeout_tlow_cnt,
|
||||
&i2c2_smbus_alert_cnt,
|
||||
&i2c2_unexpected_event_cnt,
|
||||
&i2c2_last_unexpected_event,
|
||||
&_bus2);
|
||||
});
|
||||
}
|
||||
static void test_baro_event(void) {BaroEvent(test_baro_on_baro_abs, test_baro_on_baro_diff);}
|
||||
@@ -189,16 +200,27 @@ static void test_bldc_periodic(void) {
|
||||
i2c1_transmit(0x58, 1, NULL);
|
||||
|
||||
RunOnceEvery(100,{
|
||||
uint16_t i2c1_ack_fail_cnt = i2c1.errors->ack_fail_cnt;
|
||||
uint16_t i2c1_miss_start_stop_cnt = i2c1.errors->miss_start_stop_cnt;
|
||||
uint16_t i2c1_arb_lost_cnt = i2c1.errors->arb_lost_cnt;
|
||||
uint16_t i2c1_over_under_cnt = i2c1.errors->over_under_cnt;
|
||||
uint16_t i2c1_pec_recep_cnt = i2c1.errors->pec_recep_cnt;
|
||||
uint16_t i2c1_timeout_tlow_cnt = i2c1.errors->timeout_tlow_cnt;
|
||||
uint16_t i2c1_smbus_alert_cnt = i2c1.errors->smbus_alert_cnt;
|
||||
uint16_t i2c1_unexpected_event_cnt = i2c1.errors->unexpected_event_cnt;
|
||||
uint32_t i2c1_last_unexpected_event = i2c1.errors->last_unexpected_event;
|
||||
const uint8_t _bus1 = 1;
|
||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||
&i2c1.errors->ack_fail_cnt,
|
||||
&i2c1.errors->miss_start_stop_cnt,
|
||||
&i2c1.errors->arb_lost_cnt,
|
||||
&i2c1.errors->over_under_cnt,
|
||||
&i2c1.errors->pec_recep_cnt,
|
||||
&i2c1.errors->timeout_tlow_cnt,
|
||||
&i2c1.errors->smbus_alert_cnt,
|
||||
&i2c1.errors->unexpected_event_cnt,
|
||||
&i2c1.errors->last_unexpected_event);
|
||||
&i2c1_ack_fail_cnt,
|
||||
&i2c1_miss_start_stop_cnt,
|
||||
&i2c1_arb_lost_cnt,
|
||||
&i2c1_over_under_cnt,
|
||||
&i2c1_pec_recep_cnt,
|
||||
&i2c1_timeout_tlow_cnt,
|
||||
&i2c1_smbus_alert_cnt,
|
||||
&i2c1_unexpected_event_cnt,
|
||||
&i2c1_last_unexpected_event,
|
||||
&_bus1);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -64,16 +64,27 @@ static inline void main_periodic_task( void ) {
|
||||
RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
|
||||
RunOnceEvery(256,
|
||||
{
|
||||
uint16_t i2c1_ack_fail_cnt = i2c1.errors->ack_fail_cnt;
|
||||
uint16_t i2c1_miss_start_stop_cnt = i2c1.errors->miss_start_stop_cnt;
|
||||
uint16_t i2c1_arb_lost_cnt = i2c1.errors->arb_lost_cnt;
|
||||
uint16_t i2c1_over_under_cnt = i2c1.errors->over_under_cnt;
|
||||
uint16_t i2c1_pec_recep_cnt = i2c1.errors->pec_recep_cnt;
|
||||
uint16_t i2c1_timeout_tlow_cnt = i2c1.errors->timeout_tlow_cnt;
|
||||
uint16_t i2c1_smbus_alert_cnt = i2c1.errors->smbus_alert_cnt;
|
||||
uint16_t i2c1_unexpected_event_cnt = i2c1.errors->unexpected_event_cnt;
|
||||
uint32_t i2c1_last_unexpected_event = i2c1.errors->last_unexpected_event;
|
||||
const uint8_t _bus1 = 1;
|
||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||
&i2c1_errors.ack_fail_cnt,
|
||||
&i2c1_errors.miss_start_stop_cnt,
|
||||
&i2c1_errors.arb_lost_cnt,
|
||||
&i2c1_errors.over_under_cnt,
|
||||
&i2c1_errors.pec_recep_cnt,
|
||||
&i2c1_errors.timeout_tlow_cnt,
|
||||
&i2c1_errors.smbus_alert_cnt,
|
||||
&i2c1_errors.unexpected_event_cnt,
|
||||
&i2c1_errors.last_unexpected_event);
|
||||
&i2c1_ack_fail_cnt,
|
||||
&i2c1_miss_start_stop_cnt,
|
||||
&i2c1_arb_lost_cnt,
|
||||
&i2c1_over_under_cnt,
|
||||
&i2c1_pec_recep_cnt,
|
||||
&i2c1_timeout_tlow_cnt,
|
||||
&i2c1_smbus_alert_cnt,
|
||||
&i2c1_unexpected_event_cnt,
|
||||
&i2c1_last_unexpected_event,
|
||||
&_bus1);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -161,16 +161,27 @@ static inline void main_report(void) {
|
||||
},
|
||||
{
|
||||
#ifdef USE_I2C2
|
||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||
&i2c2.errors->ack_fail_cnt,
|
||||
&i2c2.errors->miss_start_stop_cnt,
|
||||
&i2c2.errors->arb_lost_cnt,
|
||||
&i2c2.errors->over_under_cnt,
|
||||
&i2c2.errors->pec_recep_cnt,
|
||||
&i2c2.errors->timeout_tlow_cnt,
|
||||
&i2c2.errors->smbus_alert_cnt,
|
||||
&i2c2.errors->unexpected_event_cnt,
|
||||
&i2c2.errors->last_unexpected_event);
|
||||
uint16_t i2c2_ack_fail_cnt = i2c2.errors->ack_fail_cnt;
|
||||
uint16_t i2c2_miss_start_stop_cnt = i2c2.errors->miss_start_stop_cnt;
|
||||
uint16_t i2c2_arb_lost_cnt = i2c2.errors->arb_lost_cnt;
|
||||
uint16_t i2c2_over_under_cnt = i2c2.errors->over_under_cnt;
|
||||
uint16_t i2c2_pec_recep_cnt = i2c2.errors->pec_recep_cnt;
|
||||
uint16_t i2c2_timeout_tlow_cnt = i2c2.errors->timeout_tlow_cnt;
|
||||
uint16_t i2c2_smbus_alert_cnt = i2c2.errors->smbus_alert_cnt;
|
||||
uint16_t i2c2_unexpected_event_cnt = i2c2.errors->unexpected_event_cnt;
|
||||
uint32_t i2c2_last_unexpected_event = i2c2.errors->last_unexpected_event;
|
||||
const uint8_t _bus2 = 2;
|
||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||
&i2c2_ack_fail_cnt,
|
||||
&i2c2_miss_start_stop_cnt,
|
||||
&i2c2_arb_lost_cnt,
|
||||
&i2c2_over_under_cnt,
|
||||
&i2c2_pec_recep_cnt,
|
||||
&i2c2_timeout_tlow_cnt,
|
||||
&i2c2_smbus_alert_cnt,
|
||||
&i2c2_unexpected_event_cnt,
|
||||
&i2c2_last_unexpected_event,
|
||||
&_bus2);
|
||||
#endif
|
||||
},
|
||||
{
|
||||
|
||||
@@ -82,16 +82,27 @@ static inline void main_periodic_task( void ) {
|
||||
});
|
||||
#ifdef USE_I2C2
|
||||
RunOnceEvery(111, {
|
||||
uint16_t i2c2_ack_fail_cnt = i2c2.errors->ack_fail_cnt;
|
||||
uint16_t i2c2_miss_start_stop_cnt = i2c2.errors->miss_start_stop_cnt;
|
||||
uint16_t i2c2_arb_lost_cnt = i2c2.errors->arb_lost_cnt;
|
||||
uint16_t i2c2_over_under_cnt = i2c2.errors->over_under_cnt;
|
||||
uint16_t i2c2_pec_recep_cnt = i2c2.errors->pec_recep_cnt;
|
||||
uint16_t i2c2_timeout_tlow_cnt = i2c2.errors->timeout_tlow_cnt;
|
||||
uint16_t i2c2_smbus_alert_cnt = i2c2.errors->smbus_alert_cnt;
|
||||
uint16_t i2c2_unexpected_event_cnt = i2c2.errors->unexpected_event_cnt;
|
||||
uint32_t i2c2_last_unexpected_event = i2c2.errors->last_unexpected_event;
|
||||
const uint8_t _bus2 = 2;
|
||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||
&i2c2.errors->ack_fail_cnt,
|
||||
&i2c2.errors->miss_start_stop_cnt,
|
||||
&i2c2.errors->arb_lost_cnt,
|
||||
&i2c2.errors->over_under_cnt,
|
||||
&i2c2.errors->pec_recep_cnt,
|
||||
&i2c2.errors->timeout_tlow_cnt,
|
||||
&i2c2.errors->smbus_alert_cnt,
|
||||
&i2c2.errors->unexpected_event_cnt,
|
||||
&i2c2.errors->last_unexpected_event);
|
||||
&i2c2_ack_fail_cnt,
|
||||
&i2c2_miss_start_stop_cnt,
|
||||
&i2c2_arb_lost_cnt,
|
||||
&i2c2_over_under_cnt,
|
||||
&i2c2_pec_recep_cnt,
|
||||
&i2c2_timeout_tlow_cnt,
|
||||
&i2c2_smbus_alert_cnt,
|
||||
&i2c2_unexpected_event_cnt,
|
||||
&i2c2_last_unexpected_event,
|
||||
&_bus2);
|
||||
});
|
||||
#endif
|
||||
if (sys_time.nb_sec > 1) imu_periodic();
|
||||
|
||||
Reference in New Issue
Block a user