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.

TMS320F28052F: Current limiting with Instaspin FOC

Part Number: TMS320F28052F

Hey there I'm putting together an Ebike controller using Instaspin FOC and it was my intention to provide two user input variables for control of the motor whilst riding. This is a mid-driver controller, so the motor directly drives the pedal system and then goes through the bikes standard gearing.

The first variable is obviously the speed that the motor turns. With a mid-drive kit this directly relates to the cadence that you'll be pedalling at and indirectly relates to the speed via the gearing.

The second variable though was to be the current delivered to the motor and under normal riding circumstances would approximate to how much power the motor assistance can provide.

While varying the speed of the motor is extremely easy, I cannot find any straightforward way to change the current limit of the controller on the fly. Have I missed something obvious?

I have worked through all of the labs, but nothing, save for the torque controller, really talks about current limiting, except for the maximum value that you could set the motor to before initialisation.

I have searched and found this thread...

https://e2e.ti.com/support/microcontrollers/c2000/f/902/t/296202

But things don't seem to quite match up here. I've tried altering some of the values in the pid_spd section, whilst debugging, but the numbers don't actually change and simply bounce back to where they were before.

Upon the immediate initiation of the program the values present in pid_spd for outmin and outmax match the values present in ctrl.c, but as soon as the motor starts to spin it updates with a different value. It would appear that this value is constantly being updated and refreshed as part of the motors usual operational routine.

Having two variable control loops, it would seem, isn't something that instanspin has been originally designed for. Certainly it operates around two control loops, providing constant current if the motor becomes too heavily burdened, such that constant speed cannot be maintained, but I understand that controller stability is brought into the equation once you start altering the current limits on the fly.

Is there any easy way to limit the current during operation? Or possibly a way to deactivate the motor for a split second, update the maximum current somewhere, then reactivate (proving the deactivation and reactivation is very quick)? I am using lab 11e for the flying start.

Many thanks,

Matt.