Skip to content

Commit

Permalink
AMC – Add a temporary workaround in embot::hw::can (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiraz authored Sep 14, 2022
1 parent 9bf5951 commit e9e5167
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions emBODY/eBcode/arch-arm/embot/hw/embot_hw_can.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,15 @@ result_t can::transmit(embot::hw::CAN p)
return resNOK;
}

// TODO: Temporary workaround in order validate this feature without affecting the other CAN baords
#ifdef STM32HAL_BOARD_AMC
if(true == tx_IRQisEnabled(p))
{
// marco.accame on 17 aug 2022: if the TX is already ongoing, we dont want to start it again
// by calling can::s_tx_start(p) which may find the TX FIFO full and fail by losing Qtx->front().
return resOK;
}
#endif

can::s_tx_start(p);
return resOK;
Expand Down Expand Up @@ -424,6 +427,8 @@ static void can::s_tx_start(embot::hw::CAN p)
// protect Qtx: i disable tx interrupt but i keep info if it was enabled, so that at the end i re-enable it
volatile bool isTXenabled = tx_IRQdisable(p);

// TODO: Temporary workaround in order validate this feature without affecting the other CAN baords
#ifdef STM32HAL_BOARD_AMC
if(true == isTXenabled)
{
//static volatile uint32_t inhere {0};
Expand All @@ -432,6 +437,7 @@ static void can::s_tx_start(embot::hw::CAN p)
tx_IRQresume(p, isTXenabled);
return;
}
#endif

if(true == _candata_array[index].Qtx->empty())
{
Expand Down

0 comments on commit e9e5167

Please sign in to comment.