Getting unexpected response with TLE9879 bldc shield?

Announcements

Webinar: Integrated solutions for smaller, simpler low-voltage motor control design.
Join the webinar to experience!

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

cross mob
srikanth1
Level 1
Level 1
5 sign-ins First solution authored First reply posted

Hi Infineon,

We have been using TLE9879 libraries quite a lot these days and in multiple set-ups. However we seems to be confused with one of our set up for writing the software driver of BLDC motor.

Our set up is  this:

Arduino Uno <-> Arduino Ethernet Shield <-> TLE Board <-> BLDC Motor

 

Intent:

Our intent is to write BLDC motor driver based on ethernet protocol. Till the time we decide on the professional board, we would like to try with the Arduino Uno + Arduino  Ethernet Shield together to learn and achieve the same.

 

How:

So, we have written the software code with the help of TLE9879 libraries, given by Infineon, present here.

 

Problem:

We have managed to move the BLDC motor but that is not controlled the way we expect it to. We believe that clock frequencies are the problem here and would like the community to help us on this.

Arduino Uno works till 16Mhz frequency.

TLE9879 board works on 1Mhz frequency.

Arduino  Ethernet Shield works on 14Mhz frequency.

 

We believe that when we send the commands like :

shields->setMotorMode(STOP_MOTOR, BOARD1);
shields->setMotorModde(START_MOTOR, BOARD1);
 
the shields does not respond due to the difference in the clock frequencies. Is our understanding correct? Please enlighten us on this.
 
Thanks a lot in advance.
0 Likes
6 Replies
Krupashankar
Moderator
Moderator
Moderator
500 replies posted 50 likes received 25 likes received

Hi @srikanth1,

Arduino UNO board communicates directly to the BLDC_Shield board to send and receive commands. Can you please let us know the purpose of the Arduino Ethernet Shield between Arduino UNO and TLE Board as below:

Arduino Uno <-> Arduino Ethernet Shield <-> TLE Board <-> BLDC Motor

Please refer to the link: BLDC Shield for Arduino with TLE9879QXA40 for the BLDC_Shield software and Arduino Sketches. 


Problem:

We have managed to move the BLDC motor but that is not controlled the way we expect it to. 


The Motor starts only after receiving command from the Arduino in the existing code example. Can you please explain?

Can you please share details of your modified code and Setup? 

 

Thanks,

Krupashankar

0 Likes
srikanth1
Level 1
Level 1
5 sign-ins First solution authored First reply posted

Hi @Krupashankar 

Thank you for responding

The reason for using ether net in between tle 9879 shields  and arduino uno is , we need communication over cloud

via ether net .And the data received from the ether net would control the BLDC motors.

Here is the Snippet of code:

#include <PubSubClient.h>
#include "TLE9879_Group.h"
#include <Ethernet.h>
#include <SPI.h>

TLE9879_Group *shields;
// Update these with values suitable for your network.
byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
IPAddress ip("ethernet_ip");
IPAddress server("mqtt server ip");

void callback(char* topic, byte* message, unsigned int length) {
Serial.print("Message arrived on topic: ");
Serial.print(topic);
message[length] = '\0';
Serial.print(". Message: ");
String messageTemp;
Serial.println("\n");
for (int i = 0; i < length; i++) {
Serial.print((char)message[i]);
messageTemp += (char)message[i];
}
if (String(topic) == "/MDR") {
char* arr[2];
char* token = strtok((char *)( message), ":");
int i = 0;
while (token != NULL) {
arr[i] = token;
token = strtok(NULL, ":");
i++;
}
if(strcmp(arr[0], "LOW") == 0 ){
Serial.println("motor 1 stop");
shields->setMotorMode(STOP_MOTOR, BOARD1);
}else if(strcmp(arr[0], "HIGH") == 0 ){
Serial.println("motor 1 start");
shields->setMotorMode(START_MOTOR, BOARD1);
}
}
message = NULL;
}
EthernetClient ethClient;
PubSubClient client(server, 1883, callback, ethClient);
void setup()
{
Serial.begin(9600);
Ethernet.begin(mac, ip);
if(client.connect("arduinoClient")) {
Serial.println("Subscribed!");
client.subscribe("/MDR");
}
Serial.println("ETRHER net setup done!");
shields = new TLE9879_Group(1);
shields->setMode(FOC, BOARD1);
//shields->setMode(FOC, BOARD2);
shields->setMotorSpeed(3000, BOARD1);
//shields->setMotorSpeed(3000, BOARD2);
shields->setMotorMode(START_MOTOR, BOARD1);

Serial.println("Motor parameters set done!");
}
void loop()
{
client.loop();
Serial.println("Entered Condition 1: STOP Board1");
client.publish("/MDR","LOW");
delay(5000);
Serial.println("Entered Condition 3: START Board1");
client.publish("/MDR","HIGH");
delay(5000);
}

Hardware setup:

hardware_setup.jpeg

0 Likes
Krupashankar
Moderator
Moderator
Moderator
500 replies posted 50 likes received 25 likes received

Hi @srikanth1,

Have you tried interfacing only Arduino UNO and BLDC Shield with the existing example code? Does that motor operation and response meets your expectation?

SPI Clock is determined based on the master, master generates the clock (SCLK)  if the slave device is compatible with that frequency SPI communication will happen.

Can you please let us know if the code snippet shared in above post is running on Arduino UNO or Ethernet Shield? 

 

Thanks,

Krupashankar

0 Likes

Hi @Krupashankar 

I have tried by interfacing only Arduino uno and BLDC shield with existing code ,so then motors are running as expected.

the snippet of the code which had posted here  is running on arduino uno . Ethernet  is the spi slave here as like BLDC shields.

Here Ethernet shield is compatible with 14mhz .

So that Arduino uno is setting up the clock speed every time individually  to communicate with slaves.

Thanks ,

Srikanth

0 Likes

- Arduino UNO + Ethernet Shield and Arduino UNO + BLDC Shield are working as expected when we them separately.
- For Ethernet and BLDC Shield the sample code from Arduino Library is used and work perfectly as expected.

Ethernet: https://github.com/knolleary/pubsubclient/blob/master/examples/mqtt_basic/mqtt_basic.ino
BLDC: https://github.com/Infineon/TLE9879-BLDC-Shield/blob/master/examples/bldc_shield_multiple_motor_test...

- Whenever we use both the shield stacked up (Ethernet and BLDC), it doent work.

- Integrated custom code the is posted above.

0 Likes
srikanth1
Level 1
Level 1
5 sign-ins First solution authored First reply posted

Hi @Krupashankar 

we are still looking for support from from the community ,we have not get the right solution for the problem which  we are facing.

Can you guys look the above picture thoroughly,once we go with example codes the motors are running as expected.

when we go with stocking up  ether net shield along with arduino UNO and TLE9879  bldc shield then the problem arising.

 

0 Likes