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.

IWR6843: Connecting multiple radars on CAN

Part Number: IWR6843

Tool/software:

Hi,

I am using IWR6843 RADAR. I am using "long range people detection" labs firmware. In this firmware there is no CAN implementation. But with the help of reference below, I have integrated the CAN firmware in LRPD

CAN Integration User Guide.

I am getting data over CAN properly. But if I connect multiple RADARs on CAN bus then I get the data from only on RADAR over CAN. Also, I have observed that if I power off and on both the RADARs simultaneously then I can get the data from the one which is powered ON first. Are there any firmware changes do I need to do to get data from both the RADARs over CAN?

Thanks,

Manoj

  • Hey Manoj,

    First of all, I will need some more insight into how you are transmitting and receiving data. What is your current mcanCfgParams, mcanBitTimingParams, and rxMsgObjectParams and txMsgObjectParams? 

    Additionally, have you verified the following?

    • Both ends of the CAN line should be terminated with a 120 ohm resistor between the CAN low and CAN high lines to prevent reflections from impedance mismatching
    • Ensure all nodes are set to the same timing parameters - i.e. bit rate, propogation segment, phase segments, sync jump width, prescalar, etc.

    Regards,

    Kristien

  • Hi Kristien,

    Please find the attached images below for mcanCfgParams, mcanBitTimingParams, and rxMsgObjectParams and txMsgObjectParams,

        

    I have verified those two points also, everything is fine.

    I have one query regarding CANFD_Init function. Please find the screenshot below,

    Above this function there is a comment mentioned that "Currently only 1 instance of CANFD is supported. Valid value is 0." So is there possibility of having same instance id which are clashing on CAN bus and at a time only one CAN RADAR is communicating on CAN BUS. Because of having same instance id, the one who win the CAN bus access will be able to communicate and not the other one.

    Thanks,
    Manoj

  • Hey Manoj,

    The CAN-FD driver should support being able to use both CAN instances simultaneously, though I've only personally tested using the two transceivers on two separate buses. If you want to instantiate the second CAN transceiver, you will have to call CANFD_init again with ID 1 and setup new bit timings and message objects for it. You can see an example of how this is done in the 6843 CAN-FD driver binary unit test (<MMWAVE_SDK_INSTALL_DIR>/packages/ti/drivers/canfd/test/xwr68xx/main.c) under the mcanDualMsgIdRangeTest and mcanDualMultiTransmission functions.

    I also wanted to clarify that when you only get data from one transceiver, i.e., the first one to power on, do you only get data from that one transceiver for the entirety that all transceivers are on? In other words, until you power cycle all nodes simultaneously, the first node on, or perhaps the oldest node, will have priority?

    Have you checked the signals on the bus to verify whether this behavior could be linked to arbitration? Keep in mind that all nodes read back the bus value when transmitting identifier and RTR bits, and a node will stop transmitting if it transmits a recessive bit but reads back a dominant bit.

    Regards,

    Kristien

  • Hi Kristien,

    So, what I understood from this is having same instance ID is not an issue, right? That means having same instance ID for multiple RADARs "CANFD_init(0, &mcanCfgParams, &errCode);" is fine. Let me know if my understanding is correct.

    I also wanted to clarify that when you only get data from one transceiver, i.e., the first one to power on, do you only get data from that one transceiver for the entirety that all transceivers are on? In other words, until you power cycle all nodes simultaneously, the first node on, or perhaps the oldest node, will have priority? 
    Ans: Yes, you are right. I am getting data only from that one transceiver which is powered on first. I have done some experiment on this; I have pressed the reset button of two RADARs and released reset button of one of them and later the other one. So, which one reset button released first started giving me the data for entire session. 

    Have you checked the signals on the bus to verify whether this behavior could be linked to arbitration?
    Ans: I suspect this is happening. The one which is powered on is holding the bus and not releasing it. Can we do anything like once packet is sent then that RADAR can release the bus or something like that?

    Thanks,
    Manoj

  • Hey Manoj,

    So, what I understood from this is having same instance ID is not an issue, right? That means having same instance ID for multiple RADARs "CANFD_init(0, &mcanCfgParams, &errCode);" is fine. Let me know if my understanding is correct.

    That is correct. The instance ID is used to address which CAN transceiver to use on the device, i.e., either CAN 0 or CAN 1.

    The radar CAN should release the bus after sending the last 7 bits (IFS) of a CAN frame. Is the bus still being pulled low even after a message ends? As far as I know, once a transmission buffer request has been made, the CAN transceiver will handle sending out the message.

    Regards,

    Kristien

  • Hi Kristien,

    I found this thread, https://e2e.ti.com/support/sensors-group/sensors/f/sensors-forum/1297380/iwr6843aop-can-fd-multiple-devices

    By referring those modifications mentioned in this thread now I am able to communicate two radars on same CAN bus. But it is also mentioned in that thread that user doesn't know about the circumstances of making those changes. Do you have any further input on this? Is it correct doing these changes?

    Thanks,
    Manoj

  • Hey Manoj,

    As Adam mentioned in his replies, it appears that disabling the error and data interrupts allows him to receive messages on other non-radar CAN interfaces, but that he's unable to receive with radar CAN interfaces as a result. 

    As such, one possible solution could be to use a polling method to continuously check the NDAT register (New Data - triggered by a buffer receiving new data) or the FIFO status register (fill level should increase when a message has been received) and then read the respective source when a change is detected.

    Alternatively, the radar CAN receiving issue could be a result of some of the nuisances of acceptance filtering. I would highly recommend reading Section 3.4 of the Bosch MCAN User Guide, particularly Figure 6, and checking the relevant GFC fields in your software initialization. Note that there are some differences in buffer vs. FIFO receiving which is primarily outlined in Section 3.4.1 Acceptance Filtering.

    Regards,

    Kristien

  • Hi Kristien,

    Thank you for suggesting possible solution. And thank you for the recommending the document, I will look into that document.

    Regards,
    Manoj


  • Hi Manoj,

    I encountered several problems while attempting to communicate with multiple sensors over CAN. These issues have been discussed in various threads on this forum. However, not all the changes I made were necessary, and some might not have been correct.

    Nonetheless, I am now able to successfully run more than five IWR6843AOP sensors on a single CAN line. Additionally, I can receive messages on these sensors and process them further, such as configuring them. Besides extensive firmware debugging, this also required some measurements with an oscilloscope to ensure the hardware parameters were correct.

    I just wanted to let you know that it is possible. If you need any help with parameter comparisons, I might be able to assist.

    Good luck!

    Adam

  • Hey Adam,

    I appreciate you offering your help on this thread. Do you know what settings you used for your GFC parameters?

    Regards,

    Kristien

  • Hi Adam,

    Thank you so much for your help. It really helped with your older thread and thank for offering help in this thread. So right now, I am communicating with 2 CAN radars. I am getting data from 2 radars.

    Further this did you make any changes to rectify the things like which changes are required and which not? And what changes you made to successfully configure the radars?

    As Kristien said it will be very helpful if you can let us know about the settings you used. It will be highly appreciated.

    Thanks,
    Manoj

  • Hi,

    The CFG parameters are essentially the same as those posted at the beginning of this thread. I believe that if you are able to retrieve data from two devices, the parameters are correct.

    I am using a modified OOB demo with a hard-coded configuration for the initial sensor startup. To further configure the sensor over CAN, I implemented message reception within the MCANAppCallback. The received messages (collected from multiple messages) are then passed to the CLI_task method in cli.c, in the same manner as if UART were being used. Note that UART_read is commented out due to its blocking nature.

    Is there anything specific that is not working for you right now?

    Adam

  • Hi Adam,

    Thank you for your response. Right now, I am not facing any issues as such. But I have not yet tried configuring the radars. I am just taking data from radar; you can say one way communication happening as of now. I will try configuring the radars over CAN and if I face any issues will post it here. 

    Regards,
    Manoj

  • Hey Manoj,

    Another thread on handling multiple sensors on one CAN bus was recently resolved. I asked for more details on the final configuration they are using, but the poster indicated that setting the ANFE and ANFS fields to 3—i.e., reject non-matching frames—resolved their issue. You could attempt to test this on your side to see if this works on your CAN setup.

    Regards,

    Kristien

  • thank you for sharing some more insights. I will try that too and let you know.

    Adam, I have one query that you modified those parameters to work multiple radar over CAN and it worked. So what thing lead you there and you thought of changing these parameters? I just want to know the idea/reason came in your mind that if you modify those parameters then multiple radars can work over CAN.

    Thanks,
    Manoj

  • Hi, 

    I can confirm these parameters are set like this:

    mcanCfgParams->filterConfig.anfe = 0x3U;
    mcanCfgParams->filterConfig.anfs = 0x3U;

    I don't know the exact reason why these settings work; it was the result of debugging to get everything functioning correctly. However, I guess it might be related to the specific purpose of your system. In my setup, there is one master system that collects messages from all sensors for further processing. I can imagine an application where you might benefit from processing information from one sensor directly on a different sensor. My understanding is that these parameters should be set to receive in some FIFO to be able to do this. In this case, you should probably process them correctly to avoid overflowing the memory, which could potentially cause errors and lead to the sensor not working properly.

    Here is my current CAN setup:

    /*Intialize MCAN Config Params*/
    memset(mcanCfgParams, sizeof(CANFD_MCANInitParams), 0);

    mcanCfgParams->fdMode = 0x1U;
    mcanCfgParams->brsEnable = 0x1U;
    mcanCfgParams->txpEnable = 0x0U;
    mcanCfgParams->efbi = 0x0U;
    mcanCfgParams->pxhddisable = 0x0U;
    mcanCfgParams->darEnable = 0x1U;
    mcanCfgParams->wkupReqEnable = 0x1U;
    mcanCfgParams->autoWkupEnable = 0x1U;
    mcanCfgParams->emulationEnable = 0x0U;
    mcanCfgParams->emulationFAck = 0x0U;
    mcanCfgParams->clkStopFAck = 0x0U;
    mcanCfgParams->wdcPreload = 0x0U;
    mcanCfgParams->tdcEnable = 0x1U;
    mcanCfgParams->tdcConfig.tdcf = 0U;
    mcanCfgParams->tdcConfig.tdco = 8U;
    mcanCfgParams->monEnable = 0x0U;
    mcanCfgParams->asmEnable = 0x0U;
    mcanCfgParams->tsPrescalar = 0x0U;
    mcanCfgParams->tsSelect = 0x0U;
    mcanCfgParams->timeoutSelect = CANFD_MCANTimeOutSelect_CONT;
    mcanCfgParams->timeoutPreload = 0x0U;
    mcanCfgParams->timeoutCntEnable= 0x0U;
    mcanCfgParams->filterConfig.rrfe = 0x1U;
    mcanCfgParams->filterConfig.rrfs = 0x1U;
    mcanCfgParams->filterConfig.anfe = 0x3U;
    mcanCfgParams->filterConfig.anfs = 0x3U;
    mcanCfgParams->msgRAMConfig.lss = 127U;
    mcanCfgParams->msgRAMConfig.lse = 64U;
    mcanCfgParams->msgRAMConfig.txBufNum = 32U;
    mcanCfgParams->msgRAMConfig.txFIFOSize = 0U;
    mcanCfgParams->msgRAMConfig.txBufMode = 0U;
    mcanCfgParams->msgRAMConfig.txEventFIFOSize = 0U;
    mcanCfgParams->msgRAMConfig.txEventFIFOWaterMark = 0U;
    mcanCfgParams->msgRAMConfig.rxFIFO0size = 0U;
    mcanCfgParams->msgRAMConfig.rxFIFO0OpMode = 0U;
    mcanCfgParams->msgRAMConfig.rxFIFO0waterMark = 0U;
    mcanCfgParams->msgRAMConfig.rxFIFO1size = 64U;
    mcanCfgParams->msgRAMConfig.rxFIFO1waterMark = 64U;
    mcanCfgParams->msgRAMConfig.rxFIFO1OpMode = 64U;

    mcanCfgParams->eccConfig.enable = 1U;
    mcanCfgParams->eccConfig.enableChk = 1U;
    mcanCfgParams->eccConfig.enableRdModWr = 1U;

    mcanCfgParams->errInterruptEnable = 1U;
    mcanCfgParams->dataInterruptEnable = 1U;
    mcanCfgParams->appErrCallBack = MCANAppErrStatusCallback;
    mcanCfgParams->appDataCallBack = MCANAppCallback;
    }

    I'm sorry for overlooking this earlier.

    Adam

  • Hi Adam,

    Thank you for sharing your CAN configuration.

    My application is, I am using radars for obstacle avoidance. These radars will be mounted on UAS (Unmanned Aerial System). So, in my application I am also taking inputs from all the radars and processing it further for obstacle avoidance application.

    Regards,
    Manoj

  • Once again, thanks for hopping on this thread and sharing your configuration. 

    If you get the chance to test Adam's configuration or modify your configuration to reject non-matching frames, please let us know the result. 

    Regards,

    Kristien

  • Thank you so much Kristien and Adam. 

    Adam this configuration worked for me. This is really a great help for me. 

    Thank you once again to both of you.

    Regards,

    Manoj

  • Hey Manoj,

    I'm glad Adam's configuration worked out for you! There have been a few others facing issues interfacing with multiple radar devices over CAN before, but I haven't had the chance to do testing to determine a configuration that seems to generally work with multiple CAN nodes. Its nice that there's a post I can point them to as a starting point in the future!

     Looks like I owe you a beer now too! Beers

    Regards,

    Kristien

  • Hi Kristien and Adam,

    This is one the best thread to me. Collaboration of us and brainstorming in this thread really helped a lot.

    Thank you so much for your help, guys. Cheers...! 

    Regards,
    Manoj

  • Hi,

    I'm glad it is working. I enjoyed this thread as well!

    See you in the next thread, guys!

    Cheers!

    Adam