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.

TMS320F28069F: Which way is better to access register?

Genius 3095 points

Part Number: TMS320F28069F
Other Parts Discussed in Thread: CONTROLSUITE, MOTORWARE, C2000WARE

Dear team:

I find that in the controlSUITE, TI use a struct to access the registers, But in motorware,  the routine calls subfunctions to manipulate register addresses. If it is used for motor control, which method is more suitable?

Below is the example:

ControlSUITE code:

Motorware code:

Best regards

  • There isn't a definitive answer about which is better. The answer depends on your application needs and your preferences. I can give you some items to consider though.

    The driver approach that MotorWare uses is easy to read and abstracts away the need to understand all the register details. Code written with the controlSUITE/C2000Ware bit-field structures is harder to read and requires more thorough commenting to explain what the code is doing. In general the bit-field structures are faster register accesses though, since the MotorWare drivers have the overhead of performing a function call (although turning on optimization and making the functions inline can help with this).

    Note that some peripherals (like I2C, USB, and CAN) aren't covered by the MotorWare drivers, so you'll need to refer to controlSUITE for those peripherals if you need them.

    Whitney