Hi,
I modified OOB demo according to ODOC in order to use CAN-FD. It seems there are couple messages sent over CAN, however, then this error appears.
Is there some documentation describing what this error means?
Thank you,
Regars,
Adam
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.
Hi,
I modified OOB demo according to ODOC in order to use CAN-FD. It seems there are couple messages sent over CAN, however, then this error appears.
Is there some documentation describing what this error means?
Thank you,
Regars,
Adam
Hey Adam,
Thanks for reaching out regarding CAN. This error usually happens when the CAN buses are not selected/enabled on the board which causes the transmit buffers to become full. For the IWR6843AOP, you can flip S2.1 to ON to enable the CAN buses on the board. However, since it seems that there are CAN messages being sent, you might have to add a delay between transmissions using Task_sleep to allow the buffer to properly clear. You can add Task_sleep(1) before or after transmissions which should be enough time to clear the buffer, but you might want to adjust it.
We have also updated the Radar Toolbox to include a new CAN integration guide and example which covers other things to keep in mind when integrating CAN. I would recommend taking a read through it at the link below and let me know if you have any feedback:
Let me know if you have any other questions, but hopefully this helps resolve this issue.
Regards,
Kristien
Hi Kristien,
thanks for the reply. It is my custom board based on the IWR6843AOP chip, there is no S2.1 to switch between buses. I'm using pin C2 as CAN_FD_TX and pin F2 as CAN_FD_RX, my pinmux configuration is:
Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PINE15_PADAG, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
Pinmux_Set_FuncSel(SOC_XWR68XX_PINE15_PADAG, SOC_XWR68XX_PINE15_PADAG_CANFD2_TX);
Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PIND13_PADAD, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
Pinmux_Set_FuncSel(SOC_XWR68XX_PIND13_PADAD, SOC_XWR68XX_PIND13_PADAD_CANFD_RX);
I added some debug prints using CLI_write to see state of same variables (I'm not using debug probe). In Can_Transmit_Schedule function, after powering device up, it seems couple messages have been sent (CANFD_transmitData returns retVal = 0), then something wrong happen, returning retVal = ffffffff.
***********
Edit: Error -3502 still present. It appears together with retVal = ffffffff.
Thank you for your help,
Adam
I see I'm using pin /*< CAN FD (MCAN) Receive Signal*/ and /*< CANFD2 (MCANB) Transmit Signal*/.
Could MCAN vs MCANB be the problem?
Thanks,
Adam
Hey Adam,
Thank you for letting me know you're using a custom board. First of all, what CAN instance are you initializing (CANFD_init) in software, the CAN1 interface (0) or CAN2 interface (1)? I'm guessing you have been sending messages through the CAN2 interface, so I would recommend setting the RX pin for the CAN2 interface instead of setting the RX pin for the CAN1 interface. I don't think this would fix the issue as it shouldn't be necessary for transmission operations.
I would try to add a few lines of code before any CANFD_transmitData to poll the Tx buffer request pending register to wait until it gets cleared. The CANFD_transmitData function does this internally which leads to the error in the first place, but the code below will wait until the Tx buffer is cleared.
CANFD_MessageObject* ptrCanMsgObj;
CANFD_DriverMCB* ptrCanFdMCB;
/* Get the message object pointer */
ptrCanMsgObj = (CANFD_MessageObject*)handle;
/* Get the pointer to the CAN Driver Block */
ptrCanFdMCB = (CANFD_DriverMCB*)ptrCanMsgObj->ptrDriverMCB;
/* Get base address for current CAN instance
baseAddr = ptrCanFdMCB->hwCfg.regBaseAddress;
/* Wait for any pending messages */
index = (uint32_t)1U << ptrCanMsgObj->txElement;
while(index != (MCAN_getTxBufReqPend(baseAddr) & index))
If it's not being cleared, then you could try to manually cancel a request using the Tx buffer cancellation request register. This can be done using the MCAN_txBufCancellationReq
function. Instead of waiting, you could check the Tx buffer request register and cancel it if its set using MCAN_txBufCancellationReq(baseAddr, index)
. You might have to poll other transmission status registers, so I would recommend looking over the TXBRP and TXBCR registers in the Bosch MCAN User Manual for more information.
Unfortunately, I can't think of a direct solution without better knowing the cause, but maybe these workarounds can provide some insight. Let me know if this helps.
Regards,
Kristien
Hi Kristien,
we changed TX pin to use CAN1 interface (both TX and RX using same interface) and now we are able to see messages using oscilloscope. Also, it seems that it resolved Error 3502 problem. Perhaps not receiving ACK caused repetitive message transmission leading to full TX buffer?
Now I'm facing another problem, I'm going to deal with it in new question.
Thank you for your help, really appreciate it.
Best regards,
Adam
Hey Adam,
I'm glad I was able to help, and I hope one of our engineers will get back to you soon regarding your other question.
Regards,
Kristien