diff --git a/conf/messages.xml b/conf/messages.xml index cf25f32bc5..d4785486c4 100644 --- a/conf/messages.xml +++ b/conf/messages.xml @@ -1963,6 +1963,7 @@ + diff --git a/sw/airborne/boards/lisa_l/test_baro.c b/sw/airborne/boards/lisa_l/test_baro.c index 124e9d2945..24985af985 100644 --- a/sw/airborne/boards/lisa_l/test_baro.c +++ b/sw/airborne/boards/lisa_l/test_baro.c @@ -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); }); } diff --git a/sw/airborne/boards/lisa_m/test_baro.c b/sw/airborne/boards/lisa_m/test_baro.c index e77efaaed2..d0bba0376b 100644 --- a/sw/airborne/boards/lisa_m/test_baro.c +++ b/sw/airborne/boards/lisa_m/test_baro.c @@ -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); }); } diff --git a/sw/airborne/firmwares/rotorcraft/telemetry.h b/sw/airborne/firmwares/rotorcraft/telemetry.h index 80502d42de..ace0a8d03d 100644 --- a/sw/airborne/firmwares/rotorcraft/telemetry.h +++ b/sw/airborne/firmwares/rotorcraft/telemetry.h @@ -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) {} diff --git a/sw/airborne/lisa/test/lisa_test_hmc5843.c b/sw/airborne/lisa/test/lisa_test_hmc5843.c index ca499b4092..38d85caecc 100644 --- a/sw/airborne/lisa/test/lisa_test_hmc5843.c +++ b/sw/airborne/lisa/test/lisa_test_hmc5843.c @@ -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(); diff --git a/sw/airborne/lisa/test/lisa_test_itg3200.c b/sw/airborne/lisa/test/lisa_test_itg3200.c index 72a66fac96..ccebfd903e 100644 --- a/sw/airborne/lisa/test/lisa_test_itg3200.c +++ b/sw/airborne/lisa/test/lisa_test_itg3200.c @@ -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) { diff --git a/sw/airborne/lisa/test/test_board.c b/sw/airborne/lisa/test/test_board.c index 7e01422dd3..6930867d69 100644 --- a/sw/airborne/lisa/test/test_board.c +++ b/sw/airborne/lisa/test/test_board.c @@ -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); }); } diff --git a/sw/airborne/lisa/test/test_mc_asctec_v1_simple.c b/sw/airborne/lisa/test/test_mc_asctec_v1_simple.c index 2fcb0a9e07..2a2335bf71 100644 --- a/sw/airborne/lisa/test/test_mc_asctec_v1_simple.c +++ b/sw/airborne/lisa/test/test_mc_asctec_v1_simple.c @@ -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); }); diff --git a/sw/airborne/test/subsystems/test_ahrs.c b/sw/airborne/test/subsystems/test_ahrs.c index 2bb6d1b67b..5690ba6fa6 100644 --- a/sw/airborne/test/subsystems/test_ahrs.c +++ b/sw/airborne/test/subsystems/test_ahrs.c @@ -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 }, { diff --git a/sw/airborne/test/subsystems/test_imu.c b/sw/airborne/test/subsystems/test_imu.c index b7f439bfb2..c56a30b7ff 100644 --- a/sw/airborne/test/subsystems/test_imu.c +++ b/sw/airborne/test/subsystems/test_imu.c @@ -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();