Skip to content
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

Add handling of status messages for BAT and BMS in EMS baord #403

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/BAT_B.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
6 changes: 6 additions & 0 deletions emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Inc/can_utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt>
<tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp</CppX>
<nMigrate>0</nMigrate>
Expand All @@ -28,7 +28,7 @@
<TargetOption>
<CLKADS>8000000</CLKADS>
<OPTTT>
<gFlags>0</gFlags>
<gFlags>1</gFlags>
<BeepAtEnd>1</BeepAtEnd>
<RunSim>0</RunSim>
<RunTarget>1</RunTarget>
Expand Down Expand Up @@ -75,9 +75,9 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>0</CpuCode>
<CpuCode>18</CpuCode>
<DebugOpt>
<uSim>0</uSim>
<uTrg>1</uTrg>
Expand Down Expand Up @@ -183,7 +183,7 @@
<TargetOption>
<CLKADS>8000000</CLKADS>
<OPTTT>
<gFlags>0</gFlags>
<gFlags>1</gFlags>
<BeepAtEnd>1</BeepAtEnd>
<RunSim>0</RunSim>
<RunTarget>1</RunTarget>
Expand Down Expand Up @@ -230,9 +230,9 @@
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
<IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>
<CpuCode>0</CpuCode>
<CpuCode>18</CpuCode>
<DebugOpt>
<uSim>0</uSim>
<uTrg>1</uTrg>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
<TargetName>BAT_B_iCub3</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060422::V5.06 update 4 (build 422)::ARMCC</pCCUsed>
<uAC6>0</uAC6>
<pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
<uAC6>1</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>STM32L476VETx</Device>
<Vendor>STMicroelectronics</Vendor>
<PackID>Keil.STM32L4xx_DFP.2.3.0</PackID>
<PackURL>https://www.keil.com/pack/</PackURL>
<PackID>Keil.STM32L4xx_DFP.2.6.1</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000-0x20017FFF) IRAM2(0x10000000-0x10007FFF) IROM(0x8000000-0x807FFFF) CLOCK(8000000) FPU2 CPUTYPE("Cortex-M4")</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
Expand Down Expand Up @@ -186,6 +186,7 @@
<RvdsVP>2</RvdsVP>
<RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<nBranchProt>0</nBranchProt>
<hadIRAM2>1</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>
Expand Down Expand Up @@ -313,7 +314,7 @@
</ArmAdsMisc>
<Cads>
<interw>1</interw>
<Optim>1</Optim>
<Optim>2</Optim>
<oTime>0</oTime>
<SplitLS>0</SplitLS>
<OneElfS>1</OneElfS>
Expand All @@ -322,14 +323,14 @@
<PlainCh>0</PlainCh>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<wLevel>2</wLevel>
<wLevel>3</wLevel>
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>1</uC99>
<uGnu>0</uGnu>
<useXO>0</useXO>
<v6Lang>1</v6Lang>
<v6LangP>1</v6LangP>
<v6Lang>3</v6Lang>
<v6LangP>5</v6LangP>
<vShortEn>1</vShortEn>
<vShortWch>1</vShortWch>
<v6Lto>0</v6Lto>
Expand Down Expand Up @@ -614,14 +615,14 @@
<TargetName>BAT_B_R1</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
<uAC6>0</uAC6>
<pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
<uAC6>1</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>STM32L476VETx</Device>
<Vendor>STMicroelectronics</Vendor>
<PackID>Keil.STM32L4xx_DFP.2.3.0</PackID>
<PackURL>https://www.keil.com/pack/</PackURL>
<PackID>Keil.STM32L4xx_DFP.2.6.1</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000-0x20017FFF) IRAM2(0x10000000-0x10007FFF) IROM(0x8000000-0x807FFFF) CLOCK(8000000) FPU2 CPUTYPE("Cortex-M4")</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
Expand Down Expand Up @@ -790,6 +791,7 @@
<RvdsVP>2</RvdsVP>
<RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<nBranchProt>0</nBranchProt>
<hadIRAM2>1</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>
Expand Down Expand Up @@ -917,7 +919,7 @@
</ArmAdsMisc>
<Cads>
<interw>1</interw>
<Optim>1</Optim>
<Optim>2</Optim>
<oTime>0</oTime>
<SplitLS>0</SplitLS>
<OneElfS>1</OneElfS>
Expand All @@ -926,14 +928,14 @@
<PlainCh>0</PlainCh>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<wLevel>2</wLevel>
<wLevel>3</wLevel>
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>1</uC99>
<uGnu>0</uGnu>
<useXO>0</useXO>
<v6Lang>1</v6Lang>
<v6LangP>1</v6LangP>
<v6Lang>3</v6Lang>
<v6LangP>5</v6LangP>
<vShortEn>1</vShortEn>
<vShortWch>1</vShortWch>
<v6Lto>0</v6Lto>
Expand Down Expand Up @@ -1219,8 +1221,8 @@
<RTE>
<apis/>
<components>
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="4.3.0" condition="CMSIS Core">
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="4.5.0"/>
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.6.0" condition="ARMv6_7_8-M Device">
<package name="CMSIS" schemaVersion="1.7.7" url="http://www.keil.com/pack/" vendor="ARM" version="5.9.0"/>
<targetInfos>
<targetInfo name="BAT_B_R1"/>
<targetInfo name="BAT_B_iCub3"/>
Expand All @@ -1234,11 +1236,6 @@
<Layers>
<Layer>
<LayName>&lt;Project Info&gt;</LayName>
<LayDesc></LayDesc>
<LayUrl></LayUrl>
<LayKeys></LayKeys>
<LayCat></LayCat>
<LayLic></LayLic>
<LayTarg>0</LayTarg>
<LayPrjMark>1</LayPrjMark>
</Layer>
Expand Down
8 changes: 4 additions & 4 deletions emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/BAT_B.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ++++++++++++++++++
Expand All @@ -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;
Expand Down
17 changes: 16 additions & 1 deletion emBODY/eBcode/arch-arm/board/bat/BAT_Rev_B/Src/can_utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
// -----------------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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;

}


Expand Down
Loading