diff --git a/emBODY/eBcode/arch-arm/board/amc/examples/appl-01/cfg/protocol/can/EoCANprotBSperiodic_amc.c b/emBODY/eBcode/arch-arm/board/amc/examples/appl-01/cfg/protocol/can/EoCANprotBSperiodic_amc.c
index 90cb2959e..86e1ba55f 100644
--- a/emBODY/eBcode/arch-arm/board/amc/examples/appl-01/cfg/protocol/can/EoCANprotBSperiodic_amc.c
+++ b/emBODY/eBcode/arch-arm/board/amc/examples/appl-01/cfg/protocol/can/EoCANprotBSperiodic_amc.c
@@ -72,18 +72,20 @@
// --------------------------------------------------------------------------------------------------------------------
//#include "embot_core.h"
-extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__STATUS(eOcanframe_t *frame, eOcanport_t port)
+extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__INFO(eOcanframe_t *frame, eOcanport_t port)
{
-// embot::app::eth::theBATservice::canFrameDescriptor cfd
-// {
-// port,
-// frame,
-// embot::app::eth::theBATservice::canFrameDescriptor::Type::unspecified
-// };
-// embot::app::eth::theBATservice::getInstance().AcceptCANframe(cfd);
return(eores_OK);
}
+extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__STATUS_BMS(eOcanframe_t *frame, eOcanport_t port)
+{
+ return(eores_OK);
+}
+
+extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__STATUS_BAT(eOcanframe_t *frame, eOcanport_t port)
+{
+ return(eores_OK);
+}
extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__ALLTHEOTHERS(eOcanframe_t *frame, eOcanport_t port)
{
diff --git a/emBODY/eBcode/arch-arm/board/amc/examples/appl-01/cfg/theApplication_config.h b/emBODY/eBcode/arch-arm/board/amc/examples/appl-01/cfg/theApplication_config.h
index dc9c48850..71967d802 100644
--- a/emBODY/eBcode/arch-arm/board/amc/examples/appl-01/cfg/theApplication_config.h
+++ b/emBODY/eBcode/arch-arm/board/amc/examples/appl-01/cfg/theApplication_config.h
@@ -40,14 +40,14 @@ namespace embot { namespace app { namespace eth {
Process::eApplication,
#if defined(WRIST_MK2)
#if defined(WRIST_MK2_RIGHT)
- {101, 8},
+ {101, 9},
#else
- {102, 8},
+ {102, 9},
#endif
#else
- {103, 8},
+ {103, 9},
#endif
- {2023, Month::Jul, Day::thirthyone, 11, 30}
+ {2023, Month::Sep, Day::seven, 14, 00}
},
.OStick = 1000*embot::core::time1microsec,
.OSstacksizeinit = 10*1024,
diff --git a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/BAT_B.h b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/BAT_B.h
index 2ecae171d..c4d950c80 100644
--- a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/BAT_B.h
+++ b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/BAT_B.h
@@ -13,8 +13,6 @@
#ifndef BAT_B_H
#define BAT_B_H
-void dcdc_management(void);
-
extern char Firmware_vers;
extern char Revision_vers;
extern char Build_number;
@@ -84,6 +82,7 @@ extern uint8_t timerFSM_motors;
extern uint8_t DCDC_status_A;
extern uint8_t DCDC_status_B;
extern uint8_t DCDC_ctrl;
+extern uint8_t DCDC_status;
extern uint8_t HSM_PG;
extern uint8_t HSM_F;
diff --git a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/can_utility.h b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/can_utility.h
index d15845e07..1b71023b7 100644
--- a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/can_utility.h
+++ b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/can_utility.h
@@ -29,4 +29,10 @@ extern uint8_t TxData_620[8];
extern uint8_t RxData_620[8];
extern uint32_t TxMailbox_620;
+extern CAN_TxHeaderTypeDef TxHeader_629;
+extern CAN_RxHeaderTypeDef RxHeader_629;
+extern uint8_t TxData_629[8];
+extern uint8_t RxData_629[8];
+extern uint32_t TxMailbox_629;
+
#endif
diff --git a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/global_var.h b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/global_var.h
index d1a7dc7ab..f88700b62 100644
--- a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/global_var.h
+++ b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/global_var.h
@@ -91,6 +91,7 @@ extern uint8_t timerFSM_motors;
extern uint8_t DCDC_status_A;
extern uint8_t DCDC_status_B;
extern uint8_t DCDC_ctrl;
+extern uint8_t DCDC_status;
extern uint8_t HSM_PG;
extern uint8_t HSM_F;
diff --git a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/MDK-ARM/BAT_Rev_B.uvoptx b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/MDK-ARM/BAT_Rev_B.uvoptx
index a93850c17..be5eeba03 100644
--- a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/MDK-ARM/BAT_Rev_B.uvoptx
+++ b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/MDK-ARM/BAT_Rev_B.uvoptx
@@ -10,7 +10,7 @@
*.s*; *.src; *.a*
*.obj; *.o
*.lib
- *.txt; *.h; *.inc
+ *.txt; *.h; *.inc; *.md
*.plm
*.cpp
0
@@ -28,7 +28,7 @@
8000000
- 0
+ 1
1
0
1
@@ -75,9 +75,9 @@
1
0
- 0
+ 1
- 0
+ 18
0
1
@@ -183,7 +183,7 @@
8000000
- 0
+ 1
1
0
1
@@ -230,9 +230,9 @@
1
0
- 1
+ 0
- 0
+ 18
0
1
diff --git a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/MDK-ARM/BAT_Rev_B.uvprojx b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/MDK-ARM/BAT_Rev_B.uvprojx
index 28f1e1834..e64312400 100644
--- a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/MDK-ARM/BAT_Rev_B.uvprojx
+++ b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/MDK-ARM/BAT_Rev_B.uvprojx
@@ -10,14 +10,14 @@
BAT_B_iCub3
0x4
ARM-ADS
- 5060422::V5.06 update 4 (build 422)::ARMCC
- 0
+ 6190000::V6.19::ARMCLANG
+ 1
STM32L476VETx
STMicroelectronics
- Keil.STM32L4xx_DFP.2.3.0
- https://www.keil.com/pack/
+ Keil.STM32L4xx_DFP.2.6.1
+ http://www.keil.com/pack/
IRAM(0x20000000-0x20017FFF) IRAM2(0x10000000-0x10007FFF) IROM(0x8000000-0x807FFFF) CLOCK(8000000) FPU2 CPUTYPE("Cortex-M4")
@@ -186,6 +186,7 @@
2
0
0
+ 0
1
0
8
@@ -313,7 +314,7 @@
1
- 1
+ 2
0
0
1
@@ -322,14 +323,14 @@
0
0
0
- 2
+ 3
0
0
1
0
0
- 1
- 1
+ 3
+ 5
1
1
0
@@ -614,14 +615,14 @@
BAT_B_R1
0x4
ARM-ADS
- 5060750::V5.06 update 6 (build 750)::ARMCC
- 0
+ 6190000::V6.19::ARMCLANG
+ 1
STM32L476VETx
STMicroelectronics
- Keil.STM32L4xx_DFP.2.3.0
- https://www.keil.com/pack/
+ Keil.STM32L4xx_DFP.2.6.1
+ http://www.keil.com/pack/
IRAM(0x20000000-0x20017FFF) IRAM2(0x10000000-0x10007FFF) IROM(0x8000000-0x807FFFF) CLOCK(8000000) FPU2 CPUTYPE("Cortex-M4")
@@ -790,6 +791,7 @@
2
0
0
+ 0
1
0
8
@@ -917,7 +919,7 @@
1
- 1
+ 2
0
0
1
@@ -926,14 +928,14 @@
0
0
0
- 2
+ 3
0
0
1
0
0
- 1
- 1
+ 3
+ 5
1
1
0
@@ -1219,8 +1221,8 @@
-
-
+
+
@@ -1234,11 +1236,6 @@
<Project Info>
-
-
-
-
-
0
1
diff --git a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/BAT_B.c b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/BAT_B.c
index eb86993bf..141ff130f 100644
--- a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/BAT_B.c
+++ b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/BAT_B.c
@@ -10,8 +10,8 @@
#include "BAT_B.h"
char Firmware_vers = 1;
-char Revision_vers = 2;
-char Build_number = 1;
+char Revision_vers = 3;
+char Build_number = 0;
uint32_t vtol=100; // voltage tolerance for hysteresis
uint32_t vhyst=0; // voltage hysteresis
@@ -60,6 +60,8 @@ uint8_t V12motor = 0; // DCDC motor control
uint8_t V12motor_F = 0; // fault
uint8_t HSM_broken = 0; // HSM transistors broken
uint8_t HSM = 0; // HSM control
+uint8_t HSM_PG = 0;
+uint8_t HSM_F = 0;
uint8_t DCrestart = 0;
uint8_t V12board_bdc = 1; // +++++++++++++++++++++++++++++++++++++++++++++ da cambiare logica ++++++++++++++++++
@@ -78,8 +80,6 @@ uint8_t timerFSM_motors = 0;
uint8_t DCDC_status_A = 0;
uint8_t DCDC_status_B = 0;
uint8_t DCDC_ctrl = 0;
-uint8_t HSM_PG = 0;
-uint8_t HSM_F = 0;
uint16_t timeout = 0;
uint16_t time_delay = 500;
diff --git a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/can_utility.c b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/can_utility.c
index 0c7ab6538..2e973c1ab 100644
--- a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/can_utility.c
+++ b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/can_utility.c
@@ -27,13 +27,20 @@ uint32_t TxMailbox;
// then there'll be a getInstance() sort of method for retrieving the struct
// following the signleton usage in OOP
// this will help to make code cleaner and avoid duplications
-// Instantiate data for info regarding status of battery pack
+// Instantiate data regarding info of battery pack
CAN_TxHeaderTypeDef TxHeader_620;
CAN_RxHeaderTypeDef RxHeader_620;
uint8_t TxData_620[8];
uint8_t RxData_620[8];
uint32_t TxMailbox_620;
+// Instantiate data regarding status of battery pack
+CAN_TxHeaderTypeDef TxHeader_629;
+CAN_RxHeaderTypeDef RxHeader_629;
+uint8_t TxData_629[8];
+uint8_t RxData_629[8];
+uint32_t TxMailbox_629;
+
// -----------------------------------------------------------------------------------------------------------------------------
// CAN configuration
// -----------------------------------------------------------------------------------------------------------------------------
@@ -96,6 +103,14 @@ void CAN_Config(void)
TxHeader_620.DLC = 8;
TxHeader_620.TransmitGlobalTime = DISABLE;
+ /*##-6- Configure Status Battery Pack Transmission process #####################################*/
+ TxHeader_629.StdId = 0x629;
+ TxHeader_629.ExtId = 0x01;
+ TxHeader_629.RTR = CAN_RTR_DATA;
+ TxHeader_629.IDE = CAN_ID_STD;
+ TxHeader_629.DLC = 8;
+ TxHeader_629.TransmitGlobalTime = DISABLE;
+
}
diff --git a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/main.c b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/main.c
index 2c29d71b3..de88cec59 100644
--- a/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/main.c
+++ b/emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/main.c
@@ -96,6 +96,7 @@ void lightupLed(uint16_t lightup);
void checkHSM(void);
void dcdc_management(void);
void FAULT_CHECK(void);
+void dcdcStatusUpdate(void);
/* USER CODE END PFP */
@@ -150,10 +151,10 @@ int main(void)
/* USER CODE BEGIN 2 */
// HAL_TIM_Base_Start_IT(&htim6); // 100us
- HAL_TIM_Base_Start_IT(&htim7); // 1ms
- HAL_TIM_Base_Start_IT(&htim15); // 10ms
- HAL_TIM_Base_Start_IT(&htim16); // 100ms
- HAL_TIM_Base_Start_IT(&htim17); // 1s
+ HAL_TIM_Base_Start_IT(&htim7); // 1ms
+ HAL_TIM_Base_Start_IT(&htim15); // 10ms
+ HAL_TIM_Base_Start_IT(&htim16); // 100ms
+ HAL_TIM_Base_Start_IT(&htim17); // 1s
HAL_TIM_IRQHandler(&htim1);
HAL_TIM_IRQHandler(&htim2);
// HAL_TIM_IRQHandler(&htim6);
@@ -177,33 +178,6 @@ int main(void)
RST_DSPL_ON;
FAULT_REM_ON;
LED_BT_OFF;
-
-
- /* USER CODE END 2 */
-
- /* Infinite loop */
- /* USER CODE BEGIN WHILE */
-
- //uint8_t RN4871_TEST[5] = {0x01, 0x02, 0x03};
- //uint8_t RN4871_TEST[] = "$$$";
- //uint8_t RN4871_Reset[] = "SF,1,2\r\n";
-// uint8_t RN4871_Reboot[] = "R,1\r\n";
- while (1)
- {
- /* USER CODE END WHILE */
-
- /* USER CODE BEGIN 3 */
-// HAL_UART_Transmit_DMA(&huart2, (uint8_t*)RN4871_TEST, sizeof(RN4871_TEST)-1);
-// HAL_Delay(100);
-// HAL_Delay(10);
-// HAL_UART_Transmit_DMA(&huart2, (uint8_t*)RN4871_Reset, sizeof(RN4871_Reset)-1);
-// HAL_Delay(10);
-// HAL_UART_Transmit_DMA(&huart2, (uint8_t*)RN4871_Reboot, sizeof(RN4871_Reboot)-1);
-// HAL_Delay(10);
-// HAL_Delay(1000);
-
- }
- /* USER CODE END 3 */
}
/**
@@ -312,10 +286,12 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim){
}
}
if(htim->Instance==TIM6){ // timer 100us
+ // do nothing -> interrupt not used
}
if(htim->Instance==TIM7){ // timer 1ms
- CANBUS();
dcdc_management();
+ dcdcStatusUpdate();
+ CANBUS();
//HAL_TIM_Base_Stop_IT(&htim10);
//timeout=1;
}
@@ -404,8 +380,8 @@ void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc){
if( (*(adc_values+6)) > 2048) {adc_measure.I_V12motor = ((*(adc_values+6))-2048)*9;} // mA
else {adc_measure.I_V12motor = 0;}
adc_measure.I_HSM = ((*(adc_values+7))*8.5); // mA
- adc_measure.Temp_sensor = (((*(adc_values+8))*80.5)-76000)/2.5+2500; // Temperature (in °C*100) = {(VSENSE – V25) / Avg_Slope} + 25 (page 441)
- //adc_measure.Temp_sensor = ((((*(adc_values+8))*3300)/4096)-760)/2.5+25; // Temperature (in °C) = {(VSENSE – V25) / Avg_Slope} + 25 (page 441)
+ adc_measure.Temp_sensor = (((*(adc_values+8))*80.5)-76000)/2.5+2500; // Temperature (in �C*100) = {(VSENSE � V25) / Avg_Slope} + 25 (page 441)
+ //adc_measure.Temp_sensor = ((((*(adc_values+8))*3300)/4096)-760)/2.5+25; // Temperature (in �C) = {(VSENSE � V25) / Avg_Slope} + 25 (page 441)
// adc_measure.V_VINPUT = (*(adc_values+0));
// adc_measure.V_EXTPS = (*(adc_values+1));
@@ -418,24 +394,48 @@ void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc){
// adc_measure.Temp_sensor = (*(adc_values+8));
if(adc_measure.I_V12board > I_V12board_MAX){ // Check for board overcurrent
- if(timer_fault_board < 10) {timer_fault_board++;}
- else {V12board_F = 1;}
+ if(timer_fault_board < 10)
+ {
+ timer_fault_board++;
+ }
+ else
+ {
+ V12board_F = 1;
+ //Current_board_in_fault = adc_measure.I_V12board;
+ }
}else{
if(timer_fault_board > 0) {timer_fault_board--;}
+ //if(Current_board_in_fault != 0) {Current_board_in_fault = 0;}
}
if(adc_measure.I_V12motor > I_V12motor_MAX){ // Check for motors overcurrent
- if(timer_fault_motors < 10) {timer_fault_motors++;}
- else {V12motor_F = 1;}
+ if(timer_fault_motors < 10)
+ {
+ timer_fault_motors++;
+ }
+ else
+ {
+ V12motor_F = 1;
+ //Current_motor_in_fault = adc_measure.I_V12motor;
+ }
}else{
if(timer_fault_motors > 0) {timer_fault_motors--;}
+ //if(Current_motor_in_fault != 0) {Current_motor_in_fault = 0;}
}
if(adc_measure.I_HSM > I_HSM_MAX){ // Check for HSM overcurrent
- if(timer_fault_HSM < 10) {timer_fault_HSM++;}
- else {HSM_F = 1;}
+ if(timer_fault_HSM < 10)
+ {
+ timer_fault_HSM++;
+ }
+ else
+ {
+ HSM_F = 1;
+ //Current_HSM_in_fault = adc_measure.I_HSM;
+ }
}else{
if(timer_fault_HSM > 0) {timer_fault_HSM--;}
+ //if(Current_HSM_in_fault != 0) {Current_HSM_in_fault = 0;}
}
calcMean();
@@ -494,7 +494,10 @@ void calcMean(){
// As an example, firmware version can be sent just one time or every x minutes
// The rest can be sent with a higher frequency
void CANBUS(void){
+
switch(can_message){
+
+#ifdef ENABLE_GUI_CUSTOM_MSG // Define to be added as -DENABLE_GUI_CUSTOM_MSG in `Option for target... >> C/C++ >> Misc controls` for enabling all messages (Also the custom ones not related to protocol)
case 0x00:
{
TxData[0] = 0xFF; // Firmware version message
@@ -587,10 +590,13 @@ void CANBUS(void){
break;
case 0x05:
+#else
+ case 0x00:
+#endif
{
// Battery Pack Info message
vBatterydV = 0.01 * (mean.V_BATTERY);
- TxData_620[0] = vBatterydV & 0xFF; // b7-b6 Battery pack voltage
+ TxData_620[0] = vBatterydV & 0xFF; // b7-b6 Battery pack voltage
TxData_620[1] = (vBatterydV >> 8) & 0xFF;
TxData_620[2] = 0x00; // b5-b4 Instant current
TxData_620[3] = 0x00;
@@ -602,8 +608,29 @@ void CANBUS(void){
/* Transmission request Error */
Error_Handler();
}
- can_message = 0;
- }
+
+ can_message = 6;
+ }
+ break;
+
+ case 0x06:
+ {
+ TxData_629[0] = DCDC_status_A & 0xFF;
+ TxData_629[1] = DCDC_status_B & 0xFF;
+ TxData_629[2] = 0x00;
+ TxData_629[3] = 0x00;
+ TxData_629[4] = 0x00;
+ TxData_629[5] = 0x00;
+ TxData_629[6] = 0x00;
+ TxData_629[7] = 0x00;
+ if (HAL_CAN_AddTxMessage(&hcan1, &TxHeader_629, TxData_629, &TxMailbox_629) != HAL_OK){
+ /* Transmission request Error */
+ Error_Handler();
+ }
+ can_message = 0;
+ }
+ break;
+
default:
{
}
@@ -611,7 +638,6 @@ void CANBUS(void){
}
}
-
// -----------------------------------------------------------------------------------------------------------------------------
// Light up leds to display battery voltage
// -----------------------------------------------------------------------------------------------------------------------------
@@ -768,144 +794,135 @@ void dcdc_management(void){
switch(state_fsm_boards){
- case START:
- {
- timerFSM_boards++;
- state_fsm_boards_prev = START;
-
- if(timerFSM_boards >= 10){
- state_fsm_boards = READY;
- }
- }
- break;
-
- case READY:
- {
- timerFSM_boards = 0;
- PB1_LED_RED;
- }
- break;
-
- case OFF_BOARD:
- {
- EN_V12board_OFF;
- V12board=0;
- PB1_LED_RED;
- }
- break;
-
- case ON_BOARD:
- {
- if(timer_delay_board < timer_delay_board_max){
- timer_delay_board++;
- }
- else{
- EN_V12board_ON;
- V12board=1;
- timer_delay_board=0;
- }
- if(V12board==0){
- if(toggle_100ms) {PB1_LED_GREEN;}
- else {PB1_LED_OFF;}
- }
- else {PB1_LED_GREEN;}
- }
- break;
-
- case FAULT_BOARD:
- {
- EN_V12board_OFF;
- V12board=0;
- if(toggle_100ms) {PB1_LED_RED;}
- else {PB1_LED_OFF;}
- }
- break;
-
- default:
- {
-
+ case START:
+ {
+ timerFSM_boards++;
+ state_fsm_boards_prev = START;
+
+ if(timerFSM_boards >= 10){
+ state_fsm_boards = READY; // after 10ms boards are ready -> are we sure of thise timing?
+ }
+ }
+ break;
+
+ case READY:
+ {
+ timerFSM_boards = 0;
+ PB1_LED_RED;
+ }
+ break;
+
+ case OFF_BOARD:
+ {
+ EN_V12board_OFF;
+ V12board=0;
+ PB1_LED_RED;
+ }
+ break;
+
+ case ON_BOARD:
+ {
+ if(timer_delay_board < timer_delay_board_max)
+ {
+ timer_delay_board++;
+ }
+ else
+ {
+ EN_V12board_ON;
+ V12board=1;
+ timer_delay_board=0;
+ }
+ if(V12board==0){
+ if(toggle_100ms) {PB1_LED_GREEN;}
+ else {PB1_LED_OFF;}
+ }
+ else {PB1_LED_GREEN;}
+ }
+ break;
+
+ case FAULT_BOARD:
+ {
+ EN_V12board_OFF;
+ V12board=0;
+ if(toggle_100ms) {PB1_LED_RED;}
+ else {PB1_LED_OFF;}
+ }
+ break;
+
+ default:
+ {
+ }
+ break;
}
- break;
- }
- switch(state_fsm_motors){
+ switch(state_fsm_motors){
- case START:
- {
- timerFSM_motors++;
- state_fsm_motors_prev = START;
-
- if(timerFSM_motors >= 10){
- state_fsm_motors = READY;
- }
- }
- break;
-
- case READY:
- {
- timerFSM_motors = 0;
- PB2_LED_RED;
- }
- break;
-
- case OFF_MOTORS:
- {
- EN_V12motor_OFF;
- HSM_EN_OFF;
- V12motor=0;
- HSM=0;
- PB2_LED_RED;
- }
- break;
-
- case ON_MOTORS:
- {
- if(timer_delay_motor < timer_delay_motor_max){
- timer_delay_motor++;
- }
- else{
- EN_V12motor_ON;
- HSM_EN_ON;
- V12motor=1;
- HSM=1;
- timer_delay_motor=0;
- }
- if(HSM_PG==0){
- if(toggle_100ms) {PB2_LED_GREEN;}
- else {PB2_LED_OFF;}
- }
- else {PB2_LED_GREEN;}
- }
- break;
-
- case FAULT_MOTORS:
- {
- EN_V12motor_OFF;
- HSM_EN_OFF;
- V12motor=0;
- HSM=0;
- if(toggle_100ms) {PB2_LED_RED;}
- else {PB2_LED_OFF;}
- }
- break;
-
- default:
- {
-
- }
- break;
- }
+ case START:
+ {
+ timerFSM_motors++;
+ state_fsm_motors_prev = START;
+
+ if(timerFSM_motors >= 10){
+ state_fsm_motors = READY;
+ }
+ }
+ break;
+
+ case READY:
+ {
+ timerFSM_motors = 0;
+ PB2_LED_RED;
+ }
+ break;
+
+ case OFF_MOTORS:
+ {
+ EN_V12motor_OFF;
+ HSM_EN_OFF;
+ V12motor=0;
+ HSM=0;
+ PB2_LED_RED;
+ }
+ break;
+
+ case ON_MOTORS:
+ {
+ if(timer_delay_motor < timer_delay_motor_max){
+ timer_delay_motor++;
+ }
+ else
+ {
+ EN_V12motor_ON;
+ HSM_EN_ON;
+ V12motor=1;
+ HSM=1;
+ timer_delay_motor=0;
+ }
+ if(HSM_PG==0){
+ if(toggle_100ms) {PB2_LED_GREEN;}
+ else {PB2_LED_OFF;}
+ }
+ else {PB2_LED_GREEN;}
+ }
+ break;
+
+ case FAULT_MOTORS:
+ {
+ EN_V12motor_OFF;
+ HSM_EN_OFF;
+ V12motor=0;
+ HSM=0;
+ if(toggle_100ms) {PB2_LED_RED;}
+ else {PB2_LED_OFF;}
+ }
+ break;
- DCDC_ctrl = ((V12board & 0x01) << 7) +
- ((V12motor & 0x01) << 5) +
- ((HSM & 0x01) << 3) +
- (((PB1_restart || PB2_restart) & 0x01) << 0);
-
- if(DCrestart){
- PB1_restart=0;
- PB2_restart=0;
- }
+ default:
+ {
+ }
+ break;
+ }
}
#endif
@@ -1114,32 +1131,34 @@ void dcdc_management(void){
break;
}
+}
+#endif
- DCDC_ctrl = ((V12board & 0x01) << 7) +
+void dcdcStatusUpdate(void)
+{
+ DCDC_ctrl = ((V12board & 0x01) << 7) +
((V12motor & 0x01) << 5) +
((HSM & 0x01) << 3) +
(((PB1_restart || PB2_restart) & 0x01) << 0);
- DCDC_status_A = ((V12board & 0x01) << 7) +
- ((V12board_F & 0x01) << 6) +
- ((V12motor & 0x01) << 5) +
- ((V12motor_F & 0x01) << 4) +
- ((HSM & 0x01) << 3) +
- ((HSM_PG & 0x01) << 2) +
- ((HSM_F & 0x01) << 1) +
- ((HSM_broken & 0x01) << 0);
-
- DCDC_status_B = (( PB1_restart & 0x01) << 7) +
- ((PB2_restart & 0x01) << 6);
-
- if(DCrestart){
- PB1_restart=0;
- PB2_restart=0;
- }
+ DCDC_status_A = ((V12board & 0x01) << 7) +
+ ((V12board_F & 0x01) << 6) +
+ ((V12motor & 0x01) << 5) +
+ ((V12motor_F & 0x01) << 4) +
+ ((HSM & 0x01) << 3) +
+ ((HSM_PG & 0x01) << 2) +
+ ((HSM_F & 0x01) << 1) +
+ ((HSM_broken & 0x01) << 0);
+
+ DCDC_status_B = (( PB1_restart & 0x01) << 1) +
+ ((PB2_restart & 0x01) << 0);
+
+ if(DCrestart){
+ PB1_restart=0;
+ PB2_restart=0;
+ }
}
-#endif
-
void HAL_CAN_TxMailbox0CompleteCallback(CAN_HandleTypeDef* hcan1)
diff --git a/emBODY/eBcode/arch-arm/board/ems004/appl/v2/cfg/eoemsappl/EOMtheEMSapplCfg_cfg.h b/emBODY/eBcode/arch-arm/board/ems004/appl/v2/cfg/eoemsappl/EOMtheEMSapplCfg_cfg.h
index 4e158d666..e51e1baf2 100644
--- a/emBODY/eBcode/arch-arm/board/ems004/appl/v2/cfg/eoemsappl/EOMtheEMSapplCfg_cfg.h
+++ b/emBODY/eBcode/arch-arm/board/ems004/appl/v2/cfg/eoemsappl/EOMtheEMSapplCfg_cfg.h
@@ -81,7 +81,7 @@ extern "C" {
#define EOMTHEEMSAPPLCFG_VERSION_MAJOR (VERSION_MAJOR_OFFSET+3)
// minor <0-255>
// minor <0-255>
-#define EOMTHEEMSAPPLCFG_VERSION_MINOR 72
+#define EOMTHEEMSAPPLCFG_VERSION_MINOR 73
// version
@@ -89,13 +89,13 @@ extern "C" {
// year <2010-2030>
#define EOMTHEEMSAPPLCFG_BUILDDATE_YEAR 2023
// month <1-12>
-#define EOMTHEEMSAPPLCFG_BUILDDATE_MONTH 7
+#define EOMTHEEMSAPPLCFG_BUILDDATE_MONTH 9
// day <1-31>
-#define EOMTHEEMSAPPLCFG_BUILDDATE_DAY 31
+#define EOMTHEEMSAPPLCFG_BUILDDATE_DAY 7
// hour <0-23>
-#define EOMTHEEMSAPPLCFG_BUILDDATE_HOUR 11
+#define EOMTHEEMSAPPLCFG_BUILDDATE_HOUR 14
// minute <0-59>
-#define EOMTHEEMSAPPLCFG_BUILDDATE_MIN 30
+#define EOMTHEEMSAPPLCFG_BUILDDATE_MIN 00
// build date
// Info
diff --git a/emBODY/eBcode/arch-arm/board/ems004/appl/v2/src/eoappservices/embot_app_eth_theBATservice.cpp b/emBODY/eBcode/arch-arm/board/ems004/appl/v2/src/eoappservices/embot_app_eth_theBATservice.cpp
index 453917220..2c232d86f 100644
--- a/emBODY/eBcode/arch-arm/board/ems004/appl/v2/src/eoappservices/embot_app_eth_theBATservice.cpp
+++ b/emBODY/eBcode/arch-arm/board/ems004/appl/v2/src/eoappservices/embot_app_eth_theBATservice.cpp
@@ -54,7 +54,7 @@ constexpr eOservice_diagnostics_t dummy_service_diagnostics{
.errorType = eo_errortype_info,
.errorCallbackCount = 0,
.repetitionOKcase =
- 0 // 10 // with 0 we transmit report only once at succesful activation
+ 0 // 10 // with 0 we transmit report only once at successful activation
};
constexpr eOservice_cantools_t dummy_service_cantools{
@@ -81,7 +81,7 @@ struct embot::app::eth::theBATservice::Impl {
const eOmn_serv_configuration_t *tmpservcfg{nullptr};
// theBATnetvariables[i] holds pointer to the network variable of the whole
- // eOas_battery_t w/ i index theFTboards[i] contains the relenat board type
+ // eOas_battery_t w/ i index theFTboards[i] contains the relevant board type
std::array theBATnetvariables{nullptr};
std::array theBATboards{eobrd_cantype_bms};
@@ -348,29 +348,30 @@ eOresult_t embot::app::eth::theBATservice::Impl::Activate(
sd->boardinfo.type)))) { // even if it is a useless check because
// we did it before inside Verify()
- // preparation for loading can boards into EOtheCANmapping
- eObrd_canproperties_t prop = {0};
- prop.type = sd->boardinfo.type;
- prop.location.port = sd->canloc.port;
- prop.location.addr = sd->canloc.addr;
- prop.location.insideindex = eobrd_caninsideindex_none;
- prop.requiredprotocol = sd->boardinfo.protocol;
- eo_vector_PushBack(sharedcan.boardproperties, &prop);
-
- // preparation for loading entities into EOtheCANmapping
- eOcanmap_entitydescriptor_t des = {0};
- des.location.port = sd->canloc.port;
- des.location.addr = sd->canloc.addr;
- des.location.insideindex = eobrd_caninsideindex_none;
- des.index = static_cast(s);
- eo_vector_PushBack(sharedcan.entitydescriptor, &des);
-
- // data used by this class
- void *vpft = eoprot_entity_ramof_get(
+ // preparation for loading can boards into EOtheCANmapping
+ eObrd_canproperties_t prop = {0};
+ prop.type = sd->boardinfo.type;
+ prop.location.port = sd->canloc.port;
+ prop.location.addr = sd->canloc.addr;
+ prop.location.insideindex = eobrd_caninsideindex_none;
+ prop.requiredprotocol = sd->boardinfo.protocol;
+ eo_vector_PushBack(sharedcan.boardproperties, &prop);
+
+ // preparation for loading entities into EOtheCANmapping
+ eOcanmap_entitydescriptor_t des = {0};
+ des.location.port = sd->canloc.port;
+ des.location.addr = sd->canloc.addr;
+ des.location.insideindex = eobrd_caninsideindex_none;
+ des.index = static_cast(s);
+ eo_vector_PushBack(sharedcan.entitydescriptor, &des);
+
+ // data used by this class
+ void *vpft = eoprot_entity_ramof_get(
eoprot_board_localboard, eoprot_endpoint_analogsensors,
eoprot_entity_as_battery, static_cast(s));
- theBATnetvariables[s] = reinterpret_cast(vpft);
- theBATboards[s] = static_cast(sd->boardinfo.type);
+ theBATnetvariables[s] = reinterpret_cast(vpft);
+ theBATboards[s] = static_cast(sd->boardinfo.type);
+
}
}
@@ -545,7 +546,7 @@ eOresult_t embot::app::eth::theBATservice::Impl::AcceptCANframe(
loc.port = cfd.port;
loc.addr = EOCANPROT_FRAME_GET_SOURCE(cfd.frame);
loc.insideindex = eobrd_caninsideindex_none;
-
+
eOprotIndex_t index = 0;
canmonitor.touch(loc);
@@ -554,29 +555,102 @@ eOresult_t embot::app::eth::theBATservice::Impl::AcceptCANframe(
if (nullptr == bat) { // something is wrong
return eores_NOK_generic;
}
-
+
+
switch (cfd.type) {
- case canFrameDescriptor::Type::unspecified: {
- bat->status.timedvalue.temperature =
- 10 * ((static_cast(cfd.frame->data[7]) << 8) +
- static_cast(cfd.frame->data[6]));
- bat->status.timedvalue.charge = static_cast(
- (static_cast(cfd.frame->data[5]) << 8) +
- static_cast(cfd.frame->data[4]));
- int16_t curr = (static_cast(cfd.frame->data[3]) << 8) +
- static_cast(cfd.frame->data[2]);
+
+ case canFrameDescriptor::Type::info:
+ {
+ bat->status.timedvalue.temperature =
+ 10 * ((static_cast(cfd.frame->data[7]) << 8) +
+ static_cast(cfd.frame->data[6]));
+
+ bat->status.timedvalue.charge =
+ static_cast(
+ (static_cast(cfd.frame->data[5]) << 8) +
+ static_cast(cfd.frame->data[4])
+ );
+
+ int16_t curr =
+ (static_cast(cfd.frame->data[3]) << 8) +
+ static_cast(cfd.frame->data[2]);
+
bat->status.timedvalue.current =
- 0.1 * static_cast(curr);
+ 0.1 * static_cast(curr);
+
bat->status.timedvalue.voltage =
0.1 * static_cast(
(static_cast(cfd.frame->data[1]) << 8) +
- static_cast(cfd.frame->data[0]));
- break;
- }
- default:
- return eores_NOK_unsupported;
+ static_cast(cfd.frame->data[0])
+ );
+ } break;
+
+ case canFrameDescriptor::Type::status_bms:
+ {
+ /*
+ * This byte0 coming from the BMS carries out the information
+ * about the general alarm state with the folloing bits, which are only one up at time
+ * Bit0: Signature Bit - Set to 1 for the BMS device
+ * Bit1: Low Voltage
+ * Bit2: High Voltage
+ * Bit3: Overcurrent in discharge
+ * Bit4: Overcurrent in charge
+ * Bit5: Low SOC
+ * Bit6: Low temperature
+ * Bit7: High temperature
+ * Bit8: Not used (filled by cfd.frame->data[0] because of right shift of 1 but not used having only 7 alarms)
+ If we have an alram, this will persist in the minute after the alarm generation
+ even if the alarm re-enter
+ **/
+ // using embot methods copy the 8bits of bms_status into the two least significant bytes of the general timedvalue.status
+ embot::core::binary::mask::clear(bat->status.timedvalue.status, static_cast(0x0000ffff), 0);
+ embot::core::binary::bit::set(bat->status.timedvalue.status, 0);
+ embot::core::binary::mask::set(bat->status.timedvalue.status, static_cast(cfd.frame->data[0]), 1);
+ bat->status.timedvalue.age = embot::core::now();
+
+ } break;
+
+ case canFrameDescriptor::Type::status_bat:
+ {
+ /*
+ * Regarding the status info coming from the BAT carries out the following information
+ * 8 LSB defines DCDC status, i.e. voltage on board and motors regulators and Hot Swap Manager
+ * in 8 MSB the first 4bits, i.e. 0x0000000f, carries out info about push button restart phase
+ * Bit0: V12board on/off
+ * Bit1: V12board_fault oc/nrm
+ * Bit2: V12motor on/off
+ * Bit3: V12motor_fault oc/nrm
+ * Bit4: hsm on/off
+ * Bit5: hsm_pgood stbale/not_guaranteed
+ * Bit6: hsm_fault oc-ov/nrm
+ * Bit7: hsm_broken brnd/nrm
+ * Bit8: pb1_restart start_up/stable
+ * Bit9: pb2_restart start_up/stable
+ If we have an alram, this will persist in the minute after the alarm generation
+ even if the alarm re-enter
+ **/
+ // using embot methods copy the 16bits of bms_status into the two most significant bytes of the general timedvalue.status
+ uint16_t bat_status_temp16 = {0x0120};
+ embot::core::binary::mask::clear(bat->status.timedvalue.status, static_cast(0xffff0000), 0);
+
+ bat_status_temp16 = static_cast((cfd.frame->data[1] << 8 ) | cfd.frame->data[0]);
+ embot::core::binary::mask::set(bat->status.timedvalue.status, static_cast(bat_status_temp16), 16);
+ bat->status.timedvalue.age = embot::core::now();
+ } break;
+
+ case canFrameDescriptor::Type::unspecified:
+ {
+ //unspecified type do nothing - for now return unsupported error -
+ //this case should never be set when this method is called
+ return eores_NOK_unsupported;
+ } break;
+
+ default:
+ {
+ return eores_NOK_unsupported;
+ } break;
+
}
-
return eores_OK;
}
diff --git a/emBODY/eBcode/arch-arm/board/ems004/appl/v2/src/eoappservices/embot_app_eth_theBATservice.h b/emBODY/eBcode/arch-arm/board/ems004/appl/v2/src/eoappservices/embot_app_eth_theBATservice.h
index 206ff9da4..a3e48dcc8 100644
--- a/emBODY/eBcode/arch-arm/board/ems004/appl/v2/src/eoappservices/embot_app_eth_theBATservice.h
+++ b/emBODY/eBcode/arch-arm/board/ems004/appl/v2/src/eoappservices/embot_app_eth_theBATservice.h
@@ -44,6 +44,9 @@ class theBATservice {
struct canFrameDescriptor {
enum class Type : uint8_t {
+ info,
+ status_bms,
+ status_bat,
unspecified,
};
eOcanport_t port{eOcanport1};
@@ -86,8 +89,7 @@ class theBATservice {
static constexpr eOas_battery_status_t defaultBATstatus{
.timedvalue = {.age = 0,
.temperature = 0,
- .status = 0,
- .filler = 0,
+ //.status = 0,
.voltage = 0,
.current = 0,
.charge = 0}};
@@ -97,7 +99,7 @@ class theBATservice {
};
const theServiceTester::Config &servicetesterconfig() const;
-
+
private:
// this one is called inside process() when the tag is
// eoprot_tag_as_bat_config (or by theServiceTester)
diff --git a/emBODY/eBcode/arch-arm/board/mc2plus/appl/v2/cfg/eoemsappl/EOMtheEMSapplCfg_cfg.h b/emBODY/eBcode/arch-arm/board/mc2plus/appl/v2/cfg/eoemsappl/EOMtheEMSapplCfg_cfg.h
index 78a929949..56384ddf0 100644
--- a/emBODY/eBcode/arch-arm/board/mc2plus/appl/v2/cfg/eoemsappl/EOMtheEMSapplCfg_cfg.h
+++ b/emBODY/eBcode/arch-arm/board/mc2plus/appl/v2/cfg/eoemsappl/EOMtheEMSapplCfg_cfg.h
@@ -75,20 +75,20 @@ extern "C" {
#define EOMTHEEMSAPPLCFG_VERSION_MAJOR 3
// minor <0-255>
// minor <0-255>
-#define EOMTHEEMSAPPLCFG_VERSION_MINOR 54
+#define EOMTHEEMSAPPLCFG_VERSION_MINOR 55
// version
// build date
// year <2010-2030>
#define EOMTHEEMSAPPLCFG_BUILDDATE_YEAR 2023
// month <1-12>
-#define EOMTHEEMSAPPLCFG_BUILDDATE_MONTH 7
+#define EOMTHEEMSAPPLCFG_BUILDDATE_MONTH 9
// day <1-31>
-#define EOMTHEEMSAPPLCFG_BUILDDATE_DAY 31
+#define EOMTHEEMSAPPLCFG_BUILDDATE_DAY 7
// hour <0-23>
-#define EOMTHEEMSAPPLCFG_BUILDDATE_HOUR 11
+#define EOMTHEEMSAPPLCFG_BUILDDATE_HOUR 14
// minute <0-59>
-#define EOMTHEEMSAPPLCFG_BUILDDATE_MIN 30
+#define EOMTHEEMSAPPLCFG_BUILDDATE_MIN 00
// build date
// Info
diff --git a/emBODY/eBcode/arch-arm/board/mc4plus/appl/v2/cfg/eoemsappl/EOMtheEMSapplCfg_cfg.h b/emBODY/eBcode/arch-arm/board/mc4plus/appl/v2/cfg/eoemsappl/EOMtheEMSapplCfg_cfg.h
index b904f9ca3..fe1a8c70a 100644
--- a/emBODY/eBcode/arch-arm/board/mc4plus/appl/v2/cfg/eoemsappl/EOMtheEMSapplCfg_cfg.h
+++ b/emBODY/eBcode/arch-arm/board/mc4plus/appl/v2/cfg/eoemsappl/EOMtheEMSapplCfg_cfg.h
@@ -84,7 +84,7 @@ extern "C" {
#define EOMTHEEMSAPPLCFG_VERSION_MAJOR (VERSION_MAJOR_OFFSET+3)
// minor <0-255>
-#define EOMTHEEMSAPPLCFG_VERSION_MINOR 75
+#define EOMTHEEMSAPPLCFG_VERSION_MINOR 76
// version
@@ -92,13 +92,13 @@ extern "C" {
// year <2010-2030>
#define EOMTHEEMSAPPLCFG_BUILDDATE_YEAR 2023
// month <1-12>
-#define EOMTHEEMSAPPLCFG_BUILDDATE_MONTH 7
+#define EOMTHEEMSAPPLCFG_BUILDDATE_MONTH 9
// day <1-31>
-#define EOMTHEEMSAPPLCFG_BUILDDATE_DAY 31
+#define EOMTHEEMSAPPLCFG_BUILDDATE_DAY 7
// hour <0-23>
-#define EOMTHEEMSAPPLCFG_BUILDDATE_HOUR 11
+#define EOMTHEEMSAPPLCFG_BUILDDATE_HOUR 14
// minute <0-59>
-#define EOMTHEEMSAPPLCFG_BUILDDATE_MIN 30
+#define EOMTHEEMSAPPLCFG_BUILDDATE_MIN 00
// build date
diff --git a/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANprotocol.c b/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANprotocol.c
index 0770a738c..74261b1e1 100644
--- a/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANprotocol.c
+++ b/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANprotocol.c
@@ -1182,7 +1182,7 @@ const eOcanprot_functions_t s_eo_canprot_functions_periodicBattery[] =
{
{ // 000 ICUBCANPROTO_PER_BS_MSG__STATUS
EO_INIT(.former) NULL,
- EO_INIT(.parser) eocanprotINperiodic_parser_PER_BS_MSG__STATUS
+ EO_INIT(.parser) eocanprotINperiodic_parser_PER_BS_MSG__INFO
},
{ // 001
EO_INIT(.former) NULL,
@@ -1190,7 +1190,7 @@ const eOcanprot_functions_t s_eo_canprot_functions_periodicBattery[] =
},
{ // 002
EO_INIT(.former) NULL,
- EO_INIT(.parser) eocanprotINperiodic_parser_PER_BS_MSG__ALLTHEOTHERS,
+ EO_INIT(.parser) eocanprotINperiodic_parser_PER_BS_MSG__ALLTHEOTHERS
},
{ // 003
EO_INIT(.former) NULL,
@@ -1214,11 +1214,11 @@ const eOcanprot_functions_t s_eo_canprot_functions_periodicBattery[] =
},
{ // 008
EO_INIT(.former) NULL,
- EO_INIT(.parser) eocanprotINperiodic_parser_PER_BS_MSG__ALLTHEOTHERS
+ EO_INIT(.parser) eocanprotINperiodic_parser_PER_BS_MSG__STATUS_BMS
},
{ // 009
EO_INIT(.former) NULL,
- EO_INIT(.parser) NULL
+ EO_INIT(.parser) eocanprotINperiodic_parser_PER_BS_MSG__STATUS_BAT
},
{ // 010
EO_INIT(.former) NULL,
@@ -1431,7 +1431,7 @@ static eOresult_t s_eo_canprot_parse0length(eOcanframe_t *frame, eOcanport_t por
static eObool_t s_eo_canprot_filter_sourceaddress(eOcanframe_t *frame)
-{
+{
if(0 == EOCANPROT_FRAME_GET_SOURCE(frame))
{
return(eobool_true);
diff --git a/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANprotocol.h b/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANprotocol.h
index 8c7ebcec4..27a8f0411 100644
--- a/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANprotocol.h
+++ b/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANprotocol.h
@@ -48,11 +48,11 @@ extern "C" {
// - public #define --------------------------------------------------------------------------------------------------
-// we mange teh following:
+// we manage the following:
// - class: it is eOcanprot_msgclass_t
// - source: it is the can address which sent the frame [0, 14]
// - destination: it is the can address where to send the frame [0, 14]
-// - type: it is either the MSG or the CMD whcih describes the message (ICUBCANPROTO_PER_MC_MSG__POSITION, ICUBCANPROTO_POL_MC_CMD__SET_INTERACTION_MODE, etc.).
+// - type: it is either the MSG or the CMD which describes the message (ICUBCANPROTO_PER_MC_MSG__POSITION, ICUBCANPROTO_POL_MC_CMD__SET_INTERACTION_MODE, etc.).
// - idcan: it is the ID of the CAN frame
// - internal index: it is either 0 or 1 and is used in mc to specify a joint/motor
diff --git a/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANprotocol_functions.h b/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANprotocol_functions.h
index bc60540fb..a3c09944f 100644
--- a/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANprotocol_functions.h
+++ b/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANprotocol_functions.h
@@ -355,7 +355,9 @@ extern eOresult_t eocanprotMCperiodic_former_PER_MC_MSG__EMSTO2FOC_DESIRED_CURRE
// - battery: periodic
-extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__STATUS(eOcanframe_t *frame, eOcanport_t port);
+extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__INFO(eOcanframe_t *frame, eOcanport_t port);
+extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__STATUS_BMS(eOcanframe_t *frame, eOcanport_t port);
+extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__STATUS_BAT(eOcanframe_t *frame, eOcanport_t port);
extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__ALLTHEOTHERS(eOcanframe_t *frame, eOcanport_t port);
diff --git a/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANservice.c b/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANservice.c
index c11d0191f..1290610b6 100644
--- a/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANservice.c
+++ b/emBODY/eBcode/arch-arm/embobj/plus/can/EOtheCANservice.c
@@ -298,7 +298,7 @@ extern eOresult_t eo_canserv_TXwaituntildone(EOtheCANservice *p, eOcanport_t por
errdes.code = eoerror_code_get(eoerror_category_System, eoerror_value_SYS_canservices_txbusfailure);
errdes.par16 = 0x0001;
errdes.par16 |= ((uint16_t)sizeoftxfifo << 8);
- errdes.par64 = 0; // dont knw what to send up
+ errdes.par64 = 0; // dont know what to send up
errdes.sourcedevice = (eOcanport1 == port) ? (eo_errman_sourcedevice_canbus1) : (eo_errman_sourcedevice_canbus2);
errdes.sourceaddress = 0;
eo_errman_Error(eo_errman_GetHandle(), eo_errortype_error, NULL, NULL, &errdes);
diff --git a/emBODY/eBcode/arch-arm/embobj/plus/can/config-can-protocol/EoCANprotBSperiodic.c b/emBODY/eBcode/arch-arm/embobj/plus/can/config-can-protocol/EoCANprotBSperiodic.c
index 48febc7e0..b32533dd1 100644
--- a/emBODY/eBcode/arch-arm/embobj/plus/can/config-can-protocol/EoCANprotBSperiodic.c
+++ b/emBODY/eBcode/arch-arm/embobj/plus/can/config-can-protocol/EoCANprotBSperiodic.c
@@ -72,18 +72,41 @@
// --------------------------------------------------------------------------------------------------------------------
#include "embot_core.h"
-extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__STATUS(eOcanframe_t *frame, eOcanport_t port)
+extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__INFO(eOcanframe_t *frame, eOcanport_t port)
{
embot::app::eth::theBATservice::canFrameDescriptor cfd
{
port,
frame,
- embot::app::eth::theBATservice::canFrameDescriptor::Type::unspecified
+ embot::app::eth::theBATservice::canFrameDescriptor::Type::info
};
embot::app::eth::theBATservice::getInstance().AcceptCANframe(cfd);
return(eores_OK);
}
+extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__STATUS_BMS(eOcanframe_t *frame, eOcanport_t port)
+{
+ embot::app::eth::theBATservice::canFrameDescriptor cfd
+ {
+ port,
+ frame,
+ embot::app::eth::theBATservice::canFrameDescriptor::Type::status_bms
+ };
+ embot::app::eth::theBATservice::getInstance().AcceptCANframe(cfd);
+ return(eores_OK);
+}
+
+extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__STATUS_BAT(eOcanframe_t *frame, eOcanport_t port)
+{
+ embot::app::eth::theBATservice::canFrameDescriptor cfd
+ {
+ port,
+ frame,
+ embot::app::eth::theBATservice::canFrameDescriptor::Type::status_bat
+ };
+ embot::app::eth::theBATservice::getInstance().AcceptCANframe(cfd);
+ return(eores_OK);
+}
extern eOresult_t eocanprotINperiodic_parser_PER_BS_MSG__ALLTHEOTHERS(eOcanframe_t *frame, eOcanport_t port)
{