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.

IWR1642BOOST: How to set the MCAN bitTime for the object detection over CAN lab

Part Number: IWR1642BOOST
Other Parts Discussed in Thread: MMWAVEICBOOST

Hello,

I have a quick question on setting the bit time for MCAN in the odc lab. 

In that lab, in mss_main.c, the default settings were 1Mbps for the normal rate and 5Mbps for the data rate. The equations are listed as below. 

// 1000Kbps

// Nominal Bit rate = (40)/(((8+6+5)+1)*BRP) = 1Mhz
mcanBitTimingParams.nomBrp         = 0x2U;
mcanBitTimingParams.nomPropSeg = 0x8U;
mcanBitTimingParams.nomPseg1     = 0x6U;
mcanBitTimingParams.nomPseg2     = 0x5U;
mcanBitTimingParams.nomSjw          = 0x1U;

// 5 Mbps

Nominal Bit rate = (40)/(((2+2+3)+1)*BRP) = 5Mhz
mcanBitTimingParams.dataBrp          = 0x1U;
mcanBitTimingParams.dataPropSeg  = 0x2U;
mcanBitTimingParams.dataPseg1      = 0x2U;
mcanBitTimingParams.dataPseg2      = 0x3U;
mcanBitTimingParams.dataSjw           = 0x1U;

From the above equations, I understand how the 1Mbps and 5Mbps come from. From the chapter 23 (MCAN) of AWR18xx/16xx/14xx/68xx Technical Reference Manual, I learned the MCAN data rate can be set up to 10Mbps. However, I could not find the reference to calculate dataBrp, dataPropSeg, dataPseg1, dataPseg2, dataSjw in order to get 10Mbps. I am assuming those values can not be randomly set. 

Is there any reference for setting those values so that I can choose a different data rate for the MCAN?

Thank you very much for the help!

Best,

Hang

  • Hi Hang,

    Please refer to the Bosch MCAN user's manual, which I will provide a link to below. You will want to look at the sections related to the Registers NBTP and DBTP.

    https://www.bosch-semiconductors.com/media/ip_modules/pdf_2/m_can/mcan_users_manual_v330.pdf

    Let me know if there are any further questions.

    Best Regards,
    Alec

  • Hi Alec,

    Thank you very much for the reply. I took a look of the pdf and understand what is the meaning the NBTP and DBTP registers including bit settings. 

    However, I couldn't figure out a correct settings for 8Mbps for data rate. For example, I have tried both below.

    Nominal Bit rate = (40)/(((1+2+1)+1)*BRP) = 8Mhz

    mcanBitTimingParams.dataBrp          = 0x1U;
    mcanBitTimingParams.dataPropSeg  = 0x1U;
    mcanBitTimingParams.dataPseg1     = 0x1U;
    mcanBitTimingParams.dataPseg2     = 0x2U;
    mcanBitTimingParams.dataSjw         = 0x1U;

    Nominal Bit rate = (40)/(((1+1+2)+1)*BRP) = 8Mhz

    mcanBitTimingParams.dataBrp          = 0x1U;
    mcanBitTimingParams.dataPropSeg  = 0x1U;
    mcanBitTimingParams.dataPseg1     = 0x2U;
    mcanBitTimingParams.dataPseg2     = 0x1U;
    mcanBitTimingParams.dataSjw         = 0x1U;

    Both didn't work for me. Do you know where I am wrong or any other settings I need to do?

    Thank you very much for the help!

    Best,

    Hang

  • Hang,

    Couple of quick things to note. The nominal bit rate cannot be greater than 1Mbps for CANFD due to the restrictions of the protocol itself. In order to calculate the Data Bit rate, I have used a website to assist in the calculation, and will provide the link below.

    http://www.bittiming.can-wiki.info/#M_CAN

    Let me know what you find.

    Best Regards,
    Alec

  • Hi Alec,

    Thank you very much for providing the information. However, it doe not help to solve the current issues I have. 

    I think where I want to get some hints are directly related to the xWR1642 chip of the MCAN module. In the given example, it showed me how to set the data bit rate to 5Mbps and it worked for me. Then, I want to change it to 8Mbps or 10Mbps using the same formula given in the code. 

    Nominal Bit rate = (40)/(((2+2+3)+1)*BRP) = 5Mbps (Works)


    mcanBitTimingParams.dataBrp          = 0x1U;
    mcanBitTimingParams.dataPropSeg  = 0x2U;
    mcanBitTimingParams.dataPseg1      = 0x2U;
    mcanBitTimingParams.dataPseg2      = 0x3U;
    mcanBitTimingParams.dataSjw           = 0x1U;

    Nominal Bit rate = (40)/(((1+1+2)+1)*BRP) = 8Mbps (Does not work)

    mcanBitTimingParams.dataBrp          = 0x1U;
    mcanBitTimingParams.dataPropSeg  = 0x1U;
    mcanBitTimingParams.dataPseg1     = 0x2U;
    mcanBitTimingParams.dataPseg2     = 0x1U;
    mcanBitTimingParams.dataSjw         = 0x1U;

    From your expertise, could you give me some hints on where I am wrong or any other settings I missed?

    Thanks again for the help!

    Best,

    Hang

  • Hi Hang,

    A couple of questions. First, can you check that the call to CANFD_configBitTime is passing? Secondly, what does your test environment look like? Those values appear correct but I can try to verify on my end if needed.

    Best Regards,
    Alec

  • Hi Hang,

    I was working on something else and I believe I have stumbled onto your problem. Are you getting the CAN signals from the MMWAVEICBOOST? The CAN transceiver used on the MMWAVEICBOOST is the TCAN1042HGVDRQ1, and after looking at that part, it appears it only supports speeds up to 5Mb/s. To get higher speeds than this, you would need to get the CAN signals out and use a different transceiver.

    Let me know if you have any questions or thoughts.

    Best Regards,
    Alec

  • Hi Hang,

    Sorry, I just realized you are using 1642boost, so ignore my question about MMWAVEICBOOST, but the same issue applies since the 1642boost uses the TCAN1042HGVDRQ1

    Best Regards,
    Alec

  • Hi Alec,

    Thank you so much! That's helpful! I was also debugging it these days but it didn't work. Is there anyway that I can replace the chip and make it support up to 8Mbps or 10 Mbps?

    Best,

    Hang

  • Hang, 

    I believe NXP has some offerings for CAN transceivers that fit the bill here. I am not a HW design expert so take my advice with a grain of salt. I would likely recommend you a make a new post regarding swapping out the CAN transceiver to hopefully get some support from our hardware experts for this device. 

    My understanding is that to do this, you will need to tap into the digital signals for CANTX and CANRX (Not the CANH and CANL that are available on the device). You might be able to pinmux these signals out to a pin that is easy for you to access. Otherwise, you can probably tp into these signals at the location where they connect to the TCAN (You should be able to see the TCAN chip on the 1642Boost Board) and then connect them along with whatever signals you need to utilize the replacement CAN transceivers.

    Let me know if there is anything else that I can help you with, but your timing parameters look fine, your signal should just be having issues at the transceiver stage.

    Best Regards,
    Alec