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.

TMS320F280025: Cannot access specific register

Part Number: TMS320F280025
Other Parts Discussed in Thread: SYSCONFIG, C2000WARE

Tool/software:

Hi,

I'm using the C2000Ware_MotorControl_SDK_5_02_00_00 universal motor control lab project without Sysconfig and I would like to reset the CCCR registers INIT in the McanaRegs.

The way I knew in earlier versions to manipulate a register is by using the direct access like:

McanaRegs.MCAN_CCCR.bits.INIT = 0;

But this leads to an error of 

#20 identifier "McanaRegs" is undefined

Now my question is, how should one manipulate the registers in the newest versions of C2000Ware (also including sysconfig etc.)? With a sysconfig project, I cannot even find the registers with the method above. Should one directly use HWREG(...)?

Thanks

  • Hi, 

    There is no MCAN in F280025 device , it has only CAN.   

    SysConfig is based on the driverlib APIs and based on the configuration that you do, it generates the code.  So, you won't be able to use bitfield within SysConfig.

    You will add such code to your C file and include the appropriate headers so that the registers are accessible. In case of CAN, the header file to be included is "f28002x_can.h"  located in <C2000Ware>\device_support\f28002x\headers\include\ 

    Best Regards

    Siddharth

  • Oh i have chosen the wrong controller, I meant the F280039C, which has MCAN.

    Thanks for the answere, I will try it out and give feedback soon.

  • Hi, 

    Okay, Let me know if you have any further questions on this topic.

    Best Regards

    Siddharth

  • So i have tried this using the universal motor control example but i failed to access the MCanaReg, the problem seems, that hw_mcanss.h is included, which has also names like MCAN_CCCR etc. which is in the MCanaReg union and that somehow interrupts eacht other, I don't know why.

    hw_mcanss.h:

    f28003x_mcan.h:

    So I really cannot access directly the register. So I tried to use the HWREG function, but this also does not work and I don't see why. So I try to reset the MCAN_CCCR Init flag, but the following does nothing when the firmware runs it:

    When I reset the flag over the debugger, it stays at 0 and does what it is itended for. What am I doing wrong?

  • Hi, 

    You can use the driverlib function "MCAN_setOpMode" with the appropriate arguments. 

    For writing 0, you can use " MCAN_setOpMode(MCANA_DRIVER_BASE, MCAN_OPERATION_MODE_NORMAL)" 

    For writing 1, you can use " MCAN_setOpMode(MCANA_DRIVER_BASE, MCAN_OPERATION_MODE_SW_INIT)"

    Best Regards

    Siddharth

  • The MCAN peripheral is a pain to get right, use the Debug console, and the "Registers" tab to browse the registers for MCAN.  You will see the CCCR register, the INIT and the TEST register there and track those as you initialize the peripheral.

    and with the debugger connected and running, expand things: