Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

MOTIX™ MCU Forum Discussions

pjh500
Level 1
Level 1
10 replies posted 10 sign-ins 5 replies posted

Hello everyone,

I have spent many hours working on a single BLDCSHIELDTLE9879TOBO1 evaluation board mated to an Arduino Uno R3, trying to run the setParameter() function to change the parameters of the control algorithm within the TLE9879 device.

The TLE9879 device was programmed at the factory, I haven't changed it, and I have no desire to do so....

I tried running the "BLDC Single motor test" example, and then adding "shields->setParameter(FOC_START_ACCEL,1);"  at various points after "shields->setMode(FOC);" is called. I have tried adding "BOARD1" to the setParameter command but this has no affect either..

I get an acknowledgement in the serial data coming back to my PC stating that the parameter has changed, but there is no difference in the way that the evaluation board behaves.

I have tried this approach of changing multiple different parameters, within both the BEMF and FOC modes, but nothing seems to affect the behaviour of the shield...

I hope that someone can help... 😀

Kind regards,

Peter

0 Likes
1 Solution
sk7211
Moderator
Moderator
Moderator
100 sign-ins 10 solutions authored 25 replies posted

Hi @Gimballs ,

For the proper functioning of the "set parameter" command, please add one command, at line number 59, in "void changeSingleParameter(uint8 index, uint16 data1, uint16 data2)"  in  "commands.c" (in KEIL software program).

    Emo_Status.MotorState = EMO_MOTOR_STATE_UNINIT; 

 

For your reference, I am attaching the image.

Please, Let us know if you have further issues.

Thank you

Best Regards

Sahil Kumar

View solution in original post

0 Likes
29 Replies
MadenoorKris
Moderator
Moderator
Moderator
50 sign-ins First like given 25 sign-ins

@pjh500 

You need to setParameter(X,Y,Z) after setMode(FOC). 

Refer to the link below where different parameters of the motor used are set. Let me know if this helps. If not, we'll continue to debug and resolve the issue.

https://forum.digikey.com/t/driving-a-bldc-motor-with-infineons-tle9879qx-3-phase-motor-driver-shiel...

Regards,

Ram

 

0 Likes

Ram,

Thank you for your response...

This is exactly what I have tried - running setParameter(X,Y,Z) after setMode(FOC). 

I used the digikey reference to check my code against, and this matches exactly what I have done...

I have no problem with changing modes, changing motor speed and starting/stopping the motor, but my setParameter(X,Y,Z); calls have no effect...

Please could you suggest what could cause this?

Kind regards,

Peter

0 Likes
MadenoorKris
Moderator
Moderator
Moderator
50 sign-ins First like given 25 sign-ins

@pjh500 

Okay, Nice to know we're on the same page.

What exactly are you trying to change and how are you monitoring whether the change is reflected or not? can you give me some of the example commands/parameters you've tried?

Regards,

Ram

0 Likes

@MadenoorKris 

Ram,

Thanks again...

Please see below the code that I am trying to run.

I have tried changing many parameters, but I have not seen any effects.

I therefore decided to focus on parameters that should give obvious behavioural changes - the first one is the rotor alignment time (FOC_ZERO_VEC_TIME) which I set to a relatively extreme 5 seconds (this is ok because the resistance of my motor windings is relatively high, so current consumption is not excessive). I expected to see the rotor lock in place for 5 seconds before beginning the open-loop startup phase. Instead I saw no change from the default 0.1s rotor alignment time (this is listed in" foc_defines.h" file in the shield software).

I also tried setting the ramp-up rate (FOC_START_ACCEL) to 1RPM/s, where I believe the default is 1000RPM/s. I expected this to result in a very slow speed ramp on rate - with a default start speed of 100RPM and a 250RPM commanded speed, we should see a 150second ramp time.. Instead I can hear from the sound the motor makes that the ramp is still less than one second.

Please see my code below:

 

// Include the Shield library to your Arduino project
#include "TLE9879_Group.h"

// Declare Shield group object
TLE9879_Group *shields;

void setup()
{
	// Initialize the Shield group object with the
	// number of Shields in the stack
	shields = new TLE9879_Group(1);
	
	// Set the desired mode (FOC, HALL, BEMF)
	shields->setMode(FOC);
	
  delay(5000);
	
  /*
  SET PARAMETERS
  */
  shields->setParameter(FOC_ZERO_VEC_TIME,5);
  shields->setParameter(FOC_START_ACCEL,1);  // Attempt to change ramp up rate to 1RPM/s
  //shields->setParameter(FOC_R_SHUNT,0.005);
  //shields->setParameter(FOC_NOM_CUR,1);
  //shields->setParameter(FOC_PWM_FREQ,25000);
  //shields->setParameter(FOC_R_PHASE,6);
  //shields->setParameter(FOC_L_PHASE,0.006);
  //shields->setParameter(FOC_SPEED_KP,1500);
  //shields->setParameter(FOC_SPEED_KI,600);
  //shields->setParameter(FOC_MAX_POS_REF_CUR,1);
  //shields->setParameter(FOC_MAX_NEG_REF_CUR,-1);
  //shields->setParameter(FOC_MIN_POS_REF_CUR,1);
  //shields->setParameter(FOC_MIN_NEG_REF_CUR,-1);
  //shields->setParameter(FOC_MAX_CUR_SPEED,100);
  //shields->setParameter(FOC_MIN_CUR_SPEED,-100);
  //shields->setParameter(FOC_SPEED_FILT_TIME,0.01);
  //shields->setParameter(FOC_FLUX_ADJUST,0.02);
  //shields->setParameter(FOC_POLE_PAIRS,4);
  //shields->setParameter(FOC_START_CUR_IF,1);
  //shields->setParameter(FOC_END_START_SPEED,250);
  //shields->setParameter(FOC_START_FREQ_ZERO,1);
  //shields->setParameter(FOC_SWITCH_ON_SPEED,1);
  //shields->setParameter(FOC_CUR_ADJUST,0.5);
  //shields->setParameter(FOC_MAX_SPEED,2000);

  delay(2000);

  // Set the desired motor speed (RPM)
  shields->setMotorSpeed(250);

  shields->setMotorMode(START_MOTOR);

}

void loop()
{
}

 

Thank you again for your help...

Kind regards,


Peter

0 Likes
pjh500
Level 1
Level 1
10 replies posted 10 sign-ins 5 replies posted

@MadenoorKris 

Are you able to help me with this please?

Kind regards,


Peter

0 Likes
MadenoorKris
Moderator
Moderator
Moderator
50 sign-ins First like given 25 sign-ins

@pjh500 

I'll let you know about this in sometime. Please bear with the delay.

Regards,

Ram

Any updates? I have the same issue.

0 Likes
sk7211
Moderator
Moderator
Moderator
100 sign-ins 10 solutions authored 25 replies posted

Hi @Gimballs ,

For the proper functioning of the "set parameter" command, please add one command, at line number 59, in "void changeSingleParameter(uint8 index, uint16 data1, uint16 data2)"  in  "commands.c" (in KEIL software program).

    Emo_Status.MotorState = EMO_MOTOR_STATE_UNINIT; 

 

For your reference, I am attaching the image.

Please, Let us know if you have further issues.

Thank you

Best Regards

Sahil Kumar

0 Likes

Hi Sahil Kumar,

Is there any way to change the motor parameters through the Arduino code, or in some other way that does not require a  J-Link? The setParamter() function in Arduino is not working.

Thank you for the help.

 

0 Likes
sk7211
Moderator
Moderator
Moderator
100 sign-ins 10 solutions authored 25 replies posted

Hi @Gimballs ,

It is required to program after updating the code into the BLDC shield, for the proper functioning of the setparameter. Please use any debugger based on J-Link technology, like XMC LINK(KITXMCLINKSEGGERV1TOBO1).

Please, Let us know if you have further issues.

Thank you

Best Regards

Sahil Kumar

 

0 Likes
psb
Moderator
Moderator
Moderator
250 sign-ins 25 solutions authored 100 replies posted

Hi @pjh500 

   We have added a few debug statements to be displayed in the serial communication in the setParameter() and changeParameter() functions in the TLE9879_Group.cpp and Board.cpp files respectively, as attached with this message, and running them will help us in identifying the root cause of this issue. Request you to share the corresponding data log with us as well. 

Thanks,

Sai

Best Regards,
Sai
pjh500
Level 1
Level 1
10 replies posted 10 sign-ins 5 replies posted

Hello @psb & @MadenoorKris,

Thank you for your time and for the debug code...

I have run your code as suggested, and have the following data log to share... I hope this helps!

I should note, for completeness, that the behaviour of the BLDC shield is identical to the code before adding the debug lines, as expected...

Kind regards,

Peter

INFO: Starting initialization
INFO: Sending reset request to all boards
INFO: Board 1 was successfully initialized
INFO: Done initializing
INFO: mode change complete -> Board: All; FOC
In for loop ; index: 0
; end: 1
FOC Parameter StateINFO: parameter change complete -> Board: All; parameter: 84; value: 5.00
In for loop ; index: 0
; end: 1
FOC Parameter StateINFO: parameter change complete -> Board: All; parameter: 88; value: 1.00
INFO: motor speed change complete -> Board: All; 250.00
INFO: motor mode change complete -> Board: All; start

 

0 Likes
pjh500
Level 1
Level 1
10 replies posted 10 sign-ins 5 replies posted

Hello @psb & @MadenoorKris ,

I have added some more debug code to your debug version of the BLDC arduino library (see attached).

The parameters like "FOC_ZERO_VEC_TIME" that I want to change are of type "float" not "uint16", and therefore your debug code didn't print anything to show that the SPI register write section for float parameters had been reached. I am now printing to the console to show this.

I also print the response to readAnswer(), which appears to be correct (i.e. CHANGEPARAMETER + index + CONFIRM_OFFSET).

Please see my console print below:

INFO: Starting initialization
INFO: Sending reset request to all boards
INFO: Board 1 was successfully initialized
INFO: Done initializing
INFO: mode change complete -> Board: All; FOC
In for loop. ; index: 0; end: 1
FOC Parameter State. 
In float area. 
SPI Register write. 
5408
INFO: parameter change complete -> Board: All; parameter: 84; value: 5.00
In for loop. ; index: 0; end: 1
FOC Parameter State. 
In float area. 
SPI Register write. 
5412
INFO: parameter change complete -> Board: All; parameter: 88; value: 1.00
In for loop. ; index: 0; end: 1
FOC Parameter State. 
Index and Data is valid. SPI Register write. 5405
INFO: parameter change complete -> Board: All; parameter: 81; value: 4.00
INFO: motor speed change complete -> Board: All; 250.00
INFO: motor mode change complete -> Board: All; start

Please let me know what you think I should do next?

Kind regards,

Peter

0 Likes
psb
Moderator
Moderator
Moderator
250 sign-ins 25 solutions authored 100 replies posted

Hi @pjh500 ,

   Thanks a lot for going one step ahead and adding the debug commands at some useful places in the flow of the code. We'll look further and get back with our observations as soon as possible.
Can you also let us know the measurement data for the acceleration and rotor lock time, before and after implementing the code as reported by you.
Also, can you send us any log if available, which has the serial acknowledgement (in response to the receipt through SPI) data sent to the arduino from the slave controller (TLE9879QXA40).

Meanwhile, we'll analyze at our end and get back quickly.

Thanks,

Sai

Best Regards,
Sai
pjh500
Level 1
Level 1
10 replies posted 10 sign-ins 5 replies posted

Hello @psb & @MadenoorKris ,

In response to your message...

Thanks a lot for going one step ahead and adding the debug commands at some useful places in the flow of the code. We'll look further and get back with our observations as soon as possible.

No problem - I hope that you can spot what's going wrong... I expected this evaluation board to be much easier to use - I wasn't expecting to have to debug it to this extent...

Can you also let us know the measurement data for the acceleration and rotor lock time, before and after implementing the code as reported by you.

I can't easily measure the rotor lock time - I can hear when the motor windings are energised, and I can see and hear that this time is not changing as a result of changing the parameters. Again, regarding the ramp time, I can hear that the ramp time is in the order of 1second and this does not change when I change the ramp parameter. I know that's a bit subjective, but the differences I am expecting to see are substantial so I haven't tried measuring this accurately.

Also, can you send us any log if available, which has the serial acknowledgement (in response to the receipt through SPI) data sent to the arduino from the slave controller (TLE9879QXA40).

I have dumped the serial acknowledgement from the slave controller to the Arduino log that I sent in my last message (please review my code). Does that cover what you need to see? Do you need to see the message from the slave controller on an oscilloscope or is my log good enough?

Kind regards,

Peter

0 Likes
alfsin
Level 1
Level 1
First reply posted Welcome!
good morning,
i also have the same problem, have any solutions been found?
0 Likes
pjh500
Level 1
Level 1
10 replies posted 10 sign-ins 5 replies posted

Alfsin,

Frustratingly I have received no more correspondence from @psb & @MadenoorKris.

The solution appears to be to use a competitors product.

Kind regards,

Peter

 

0 Likes
alfsin
Level 1
Level 1
First reply posted Welcome!
have you given up?
0 Likes
pjh500
Level 1
Level 1
10 replies posted 10 sign-ins 5 replies posted

No, I haven't given up... I would like to be able to use the hardware that I purchased...

However, my feeling is that the issue is within the firmware within the shield itself..

Varying the motor parameters is fairly fundamental for a motor control shield, so I'm very disappointed not to have received a definitive answer from Infineon.

Kind regards,


Peter

0 Likes
alfsin
Level 1
Level 1
First reply posted Welcome!
why do you think this?
0 Likes
pjh500
Level 1
Level 1
10 replies posted 10 sign-ins 5 replies posted

I think this because I have been unable to see any difference in motor behaviour when varying any of the parameters referenced in the documentation... This would suggest that the arduino code is not at fault. The arduino code is also very simple, so it's not like multiple function calls are required to affect the desired parameter changes...

0 Likes
msuarez
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Any luck? I can see that this has been stuck for quite a while, I am on the same predicament at the moment, changing parameters do not seem to have any effect when done thru arduino libs (FOC)

 

 

0 Likes
nichese50
Level 1
Level 1
First reply posted Welcome!

I have no problem with changing modes, changing motor speed and starting/stopping the motor, but my setParameter(X,Y,Z); calls have no effect...

teatv.ltd

hellodear.in

0 Likes
msuarez
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Has anyone tried re flashing the board? (thinking that may contain old / buggy firmware) I cannot try it at the moment since I don't have a j-link

 

 

0 Likes
pjh500
Level 1
Level 1
10 replies posted 10 sign-ins 5 replies posted

Hi msuarez,

I haven't been able to do this since I don't own a J-link, nor do I have access to one.

They are quite expensive for the hobbyist, and given the board was $30 or so when I purchased it, I'm not going to spend more cash on a J-link to solve Infineon's problems...

If Infineon would like to reflash my board for me or send me one that works as per the documentation, that would be great....

Kind regards,
Peter

0 Likes
msuarez
Level 1
Level 1
5 replies posted 5 sign-ins First reply posted

Indeed, I asked for 'compatible library' with 'whatever firmware this was flashed with' or 'whatever sources this was flashed with' to make the lib myself but nothing so far 

Out of curiosity I ordered one "SEGGER J-Link EDU" for 24.6€ to try out, will see if it can be salvaged in some way. I have the feeling that even with latest firmware the problem may still exist, will see.

Did you get another controller worth trying? I'm also looking for alternatives for bldc sensorless, preferably bemf (I really don't need more than 600rpm myself), don't wanna do my own pcb if I can avoid it for 30-40€

 

0 Likes
pjh500
Level 1
Level 1
10 replies posted 10 sign-ins 5 replies posted

Unfortunately life got in the way, and I haven't had much chance to pick up my project since.... I wasted a lot of time trying to get this board to work...

If Infineon could resolve this problem, then I will pick the project back up....

I'm not sure what's required to get them to take this seriously....

Kind regards,
Peter

0 Likes
psb
Moderator
Moderator
Moderator
250 sign-ins 25 solutions authored 100 replies posted

Hello, 

There are currently known gaps in the BLDC shield software. We are working on it. We will update the code as soon as possible.

 

Best Regards,
Sai
0 Likes
smidt
Level 1
Level 1
5 questions asked 5 replies posted 10 sign-ins

@psb  Has the code been updated? I am considering a large order of these Arduino shields but if there have been no updates it does not seem worth it.

0 Likes