This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EK-TM4C1294XL CAN RX interrupt not working after upgrading to 2.1.3.156

Other Parts Discussed in Thread: EK-TM4C1294XL

Hello,


I just upgraded to TivaWare 2.1.3.156, and my application which runs on a EK-TM4C1294XL just stopped receiving CAN packets.


My application is based on the examples/peripherals/can/simple_rx.c, and after upgrading to 2.1.3.156, I only receive the first CAN packet.

Excerpt of the code:

void motorCAN_Init(void)
{
  MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
  
  MAP_GPIOPinConfigure(GPIO_PA0_CAN0RX);
  MAP_GPIOPinConfigure(GPIO_PA1_CAN0TX);

  MAP_GPIOPinTypeCAN(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

  MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN0);

  MAP_CANInit(CAN0_BASE);

  MAP_CANBitRateSet(CAN0_BASE, TM4C129FREQ, 1000000);

  CANIntRegister(CAN0_BASE, CAN0IntHandler);
  
  // Enable interrupts on the CAN peripheral.  
  MAP_CANIntEnable(CAN0_BASE, CAN_INT_MASTER | CAN_INT_ERROR);// | CAN_INT_STATUS);

  MAP_IntEnable(INT_CAN0);
 
  MAP_CANEnable(CAN0_BASE);

  g_sCAN0RxMessage.ui32MsgID = CAN0RXID;
  g_sCAN0RxMessage.ui32MsgIDMask = 0;
  g_sCAN0RxMessage.ui32Flags = MSG_OBJ_RX_INT_ENABLE | MSG_OBJ_USE_ID_FILTER;
  g_sCAN0RxMessage.ui32MsgLen = sizeof(g_sRXMsgData);
  g_sCAN0RxMessage.pui8MsgData = (uint8_t *)&g_sRXMsgData;

  MAP_CANMessageSet(CAN0_BASE, RXOBJECT, &g_sCAN0RxMessage, MSG_OBJ_TYPE_RX);

  g_sCAN0TxMessage.ui32MsgID = CAN0TXID;
  g_sCAN0TxMessage.ui32MsgIDMask = 0;
  g_sCAN0TxMessage.ui32Flags = MSG_OBJ_NO_FLAGS;
  g_sCAN0TxMessage.ui32MsgLen = sizeof(g_sTXMsgData);
  g_sCAN0TxMessage.pui8MsgData = (uint8_t *)&g_sTXMsgData;
}

static void CAN0IntHandler(void)
{
  uint32_t ui32Status;

  // Read the CAN interrupt status to find the cause of the interrupt
  ui32Status = MAP_CANIntStatus(CAN0_BASE, CAN_INT_STS_CAUSE);

  // If this was a status interrupt acknowledge it by reading the CAN
  // controller status register.
  if (ui32Status == CAN_INT_INTID_STATUS)
  {
    ui32Status = MAP_CANStatusGet(CAN0_BASE, CAN_STS_CONTROL);

    g_ui32ErrFlag |= ui32Status;
    
    // Send error to external handler
    if (g_ui32ErrFlag) 
      motorCAN_ISRHook(g_ui32ErrFlag | CAN_HOOK_ERROR_MASK);
      
    MAP_CANIntClear(CAN0_BASE, CAN_INT_INTID_STATUS);
  }

  // Check if the cause is message object RXOBJECT, which we are using
  // for receiving messages.
  else if (ui32Status == RXOBJECT)
  {
    MAP_CANIntClear(CAN0_BASE, RXOBJECT);

    g_ui32RXMsgCount++;

    g_ui32ErrFlag = 0;
    
    // Set flag to indicate received message is pending.
    motorCAN_ISRHook(ui32Status);
  }
}

// Hook which runs on ISR context!!
void motorCAN_ISRHook(uint32_t ui32Status)
{
  if (xCANParserTaskHandle != NULL)
  {
    BaseType_t xHigherPriorityTaskWoken = pdFALSE;
    xTaskNotifyFromISR(xCANParserTaskHandle, ui32Status, eSetValueWithOverwrite, &xHigherPriorityTaskWoken);
    portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
  }
}

uint32_t motorCAN_ReceiveMessage(uint8_t *pui8RXBuff)
{
  ROM_CANMessageGet(CAN0_BASE, RXOBJECT, &g_sCAN0RxMessage, false);
  for (int i=0; i<g_sCAN0RxMessage.ui32MsgLen; i++) pui8RXBuff[i] = g_sCAN0RxMessage.pui8MsgData[i];
  return g_sCAN0RxMessage.ui32MsgLen;
}
// task while:
    ui32Notification = ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
    // Get the CAN message
    tFbkMsg sFbkMsg;
    sFbkMsg.length = motorCAN_ReceiveMessage(sFbkMsg.data);

At first glance, it seems that the new CANIntClear, does not really clear the interrupt.

When I revert the changes made by the new TivaWare to CANIntClear, it works.

What can be the issue?