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.

C2000-DIGITAL-CONTROL-LIBRARY: Disabling Interrupts Issue

Part Number: C2000-DIGITAL-CONTROL-LIBRARY

Hi,

I saw below sentence at DCL user's guide about disabling interrupts during parameter update and want to learn it further.

"The first such sub-structure contains a Shadow Parameter Set (SPS), which the user loads prior to executing a parameter update sequence. The update sequence performs a safe copy of the SPS parameters into the main controller structure by disabling interrupts before the copy sequence and re-enabling them afterwards. This ensures the controller never runs with a partially updated parameter set, and allows controller parameters to be updated without disturbing the control loop."

1) Which function does disable interrupt and where is it written in software? Can you show me related lines?

2) Does this disabling feauture disable all of the interrupts or some of them? Can you provide more information?

3) How many system cycles does my interrupts gets disabled?

4) I will tune my PID on system tests, therefore, I need my interrupts continue during parameter update. Can I disable this feature?

Thanks in advance.

  • Hi Gokhan,

    Here's the answer in the same format as your Qs.

    1) only functions start with DCL_updateXXX disables the interrupt by calling DCL_DISABLE_INTS, you can search for all the occurrences of DCL_DISABLE_INTS in DCLF32.h.

    2) besides from regular update routine, we also offer the "force" update routine in terms of DCL_fupdateXXX that does not disable interrupts. Be sure to include the .asm files in your project root as it is implemented as an external assembly module.

    3)It depends on the type of controller you're concerning with as parameter size varies. All float32_t attribute assignments are atomic so the clock cycle time disabled will be the amount of attributes in the controller's SPS struct. (for instance, DCL_PI will be 6 and DCL_PID will take 8 cycles)

    4) Yes, absolutely, you can also use DCL_fupdateXXX so it doesn't disable the interrupt. However, if you'd wish to have an ISR constantly checking to see if controller needs to be updated via semaphore (set by DCL_REQUEST_UPDATE(ptr), you can go into the DCL_updateXXX implementation and manually delete the line concerning DCL_DISABLE_INTS and DCL_RESTORE_INTS.

    Let me know if you need further clarification. Hope this helps!

    Best,

    Sen Wang