Hi Team,
We are developing code for TI TM4C1233H6PM microcontroller. We have TI rtos and also TI boot code from TI.
In TI code bl_can.c file, there is a function called CANMessageGetRx() inside it where have code like this:
if ((ui16MsgCtrl & (uint16_t) (CAN_IF1MCTL_NEWDAT | CAN_IF1MCTL_MSGLST))
== (uint16_t) CAN_IF1MCTL_NEWDAT)
{
//
// Get the amount of data needed to be read.
//
ui32Bytes = ui16MsgCtrl & (uint16_t) CAN_IF1MCTL_DLC_M;
//
// Read out the data from the CAN registers 16 bits at a time.
//
pui16Data = (uint16_t*) pui8Data;
pui16Data[0u] = CANRegRead(CAN0_BASE + CAN_O_IF1DA1);
pui16Data[1u] = CANRegRead(CAN0_BASE + CAN_O_IF1DA2);
pui16Data[2u] = CANRegRead(CAN0_BASE + CAN_O_IF1DB1);
pui16Data[3u] = CANRegRead(CAN0_BASE + CAN_O_IF1DB2);
//
// Now clear out the new data flag.
//
CANRegWrite(CAN0_BASE + CAN_O_IF1CMSK, (uint16_t) CAN_IF1CMSK_NEWDAT);
//
// Transfer the message object to the message object specific by
// MSG_OBJ_BCAST_RX_ID.
//
CANRegWrite(CAN0_BASE + CAN_O_IF1CRQ, (uint16_t) MSG_OBJ_BCAST_RX_ID);
//
// Wait for busy bit to clear
//
while ((CANRegRead(CAN0_BASE + CAN_O_IF1CRQ)
& (uint16_t) CAN_IF1CRQ_BUSY) != 0u)
{
}
}
else
{
//
// Data was lost so inform the caller.
//
ui32Bytes = 0xffffffffu;
}
My question to TI is how do we recover from the situation of ui32Bytes = 0xffffffffu?. Any remedy?
To make the code clear to you. I copy the header portion of the code so you can see It is from TI.
//*****************************************************************************
//
// bl_can.c - Functions to transfer data via the CAN port.
//
// Copyright (c) 2008-2020 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 2.2.0.295 of the Tiva Firmware Development Package.
//
//*****************************************************************************