Other Parts Discussed in Thread: AM3359
Hello,
I'm currently running a little homemade program on my board. (AM3359 ICE V2)
It uses UART and DCAN in both ways (using Starterware).
I did succeed to make the UART work and also the DCAN TX but I can't make the DCAN RX work.
I'm trying to wait for an interrupt before reading the new incoming data but I never receive the interrupt.
static void RXDCAN(unsigned int rxID, uint32_t * rxdata){
entry.flag = DCAN_MSG_DIR_RX;
entry.id = rxID;
uint32_t msgNum;
CANMsgObjectConfig(SOC_DCAN_0_REGS, &entry);
while(1){
if((DCANIntrStatus(SOC_DCAN_0_REGS, DCAN_INTR_LINE_NUM_0) != DCAN_NO_INT_PENDING) &&
((DCANIntrStatus(SOC_DCAN_0_REGS, DCAN_INTR_LINE_NUM_0) != DCAN_ERROR_OCCURED))) {
/* Get the number of the message object which caused the interrupt */
msgNum = DCANIntrStatus(SOC_DCAN_0_REGS, DCAN_INTR_LINE_NUM_0);
CONSOLEUtilsPrintf("%d\n",msgNum);
if((msgNum >= (CAN_NUM_OF_MSG_OBJS/2)) && (msgNum < CAN_NUM_OF_MSG_OBJS)){
/* Read a received message from message RAM to interface register */
CANReadMsgObjData(SOC_DCAN_0_REGS, msgNum, rxdata, DCAN_IF_REG_NUM_2);
/* Clear the Interrupt pending status */
CANClrIntPndStat(SOC_DCAN_0_REGS, msgNum, DCAN_IF_REG_NUM_2);
/* Disable the receive interrupt of the message object */
CANRxIntDisable(SOC_DCAN_0_REGS, msgNum, DCAN_IF_REG_NUM_2);
/* Invalidate the receive message object */
CANInValidateMsgObject(SOC_DCAN_0_REGS, msgNum, DCAN_IF_REG_NUM_2);
CONSOLEUtilsPrintf("RX\n");
break;
}
if(msgNum < (CAN_NUM_OF_MSG_OBJS/2)){
/* Clear the Interrupt pending status */
CANClrIntPndStat(SOC_DCAN_0_REGS, msgNum, DCAN_IF_REG_NUM_1);
/* Disable the receive interrupt of the message object */
CANRxIntDisable(SOC_DCAN_0_REGS, msgNum, DCAN_IF_REG_NUM_1);
/* Invalidate the receive message object */
CANInValidateMsgObject(SOC_DCAN_0_REGS, msgNum, DCAN_IF_REG_NUM_1);
CONSOLEUtilsPrintf("TX\n");
}
}
}
}
Here is my DCAN RX function and here my interrupt configuration :
/* Enable the error interrupts */
DCANIntrEnable(SOC_DCAN_0_REGS, DCAN_INTR_MASK_ERROR);
/* Enable the interrupt line 0 of DCAN module */
DCANIntrLineEnable(SOC_DCAN_0_REGS, DCAN_INTR_LINE_NUM_0, TRUE);
/* Enable the RX message object interrupt on interrupt line 0 */
DCANMsgObjIntrEnable(SOC_DCAN_0_REGS, DCAN_MSG_OBJ_INTR_MASK_RX, DCAN_IF_REG_NUM_2);
Where did I make it wrong ?
Thank you,
Nicola