TLE493D with PSoC 4 Pioneer Kit strange behavior

Announcements

Measure CO2 When It Matters - Infineon’s XENSIV™ PAS CO2 now comes in SparkFun Red. Check it now!

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

cross mob
lock attach
Attachments are accessible only for community members.
Michael_K
Level 3
Level 3
25 replies posted 10 likes given 50 sign-ins

Hello everybody,

Hardware: PSoC 4 Pioneer Kit 042

2x TLE493D 3D Hallsensors 


The problem is that after I flash or reset the board, the sensors are sometimes (almost every second reset) not initialized correctly.
After the reset I get a normal communication or only the first sensor is initialized and the second one gets stuck and there are only interrupts on the SDC line.

Although I only have a delay of 150 µs between the initialization of the first and second sensor in my source code, I measure a delay after the reset of the board of 60 ms as shown in the picture.

Michael_K_0-1637853881726.png

The reset() function resets both sensors by sending 0xFF twice and 0x00 twice with a delay of 30 µs to the I2C bus as described in the User Manual.

After that I initialize the sensor one with the address 0x22 and then the Vcc of the second sensor power up and init the second sensor with the address 0x35

 

// ---------------------------------------------------------
    /*********************************************************
    * Configuration and initialization of the TLE493D sensor
    ********************************************************/
    reset();
        // Power Off / Power On the TLE493D
    VDD_sensor_Write(0);
        
    TLE493D_Init(TLE493D_AW2B6_I2C_A1_ADDR);
    VDD_sensor_Write(1);
    CyDelayUs(150); // Small Delay
    TLE493D_Init(TLE493D_AW2B6_I2C_A0_ADDR);
    UART_PutString(" Beginne mit der Kalibrierung  ");
    UART_PutCRLF();
    CyDelay(100);

 

 

Why does this error happen and where does the 60 ms delay come from?

 

 Best Regards

Michael 

0 Likes
10 Replies
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

Hello.

You might want to check this thread having similar issue, but not resolved by Infineon yet.
TLE493DW2B6A1HTSA1 I2C address - Infineon Developer Community

BTW, those I2C address's don't match the Infineon TLE493D datasheet.
Product Name (infineon.com)

Can you provide complete part number.

Have you configured KIT-042 for 3.3V operating voltage?
This sensor is 3.3V only, not 5V.

0 Likes
Michael_K
Level 3
Level 3
25 replies posted 10 likes given 50 sign-ins

Hello Bibi,

the voltage is 3.3 V at the I²C bus and at the VDD pins.

I have two self-made breakout boards with the sensor TLE493DA2B6HTSA1CT from digi-key and two TLE493D-W2B6 3Dsense Shields2Go.

I had a delay of 60 ms in my init procedure and after I removed it, it ran better, but still not 100%.  And I think it also has an influence if two sensors of type W2B6 or A2B6 are connected. I had felt less problems when they are the same.

On Monday I will examine it with an oscilloscope, so that I may see more than with the digital logic analyzer.

I will check the link and keep you up to date.

Best Regards and have a nice weekend

Michael

0 Likes
Michael_K
Level 3
Level 3
25 replies posted 10 likes given 50 sign-ins

Hello Bibi,

 

she sensor is operated with 3.3 V at the VDD pin. The SDA and SCL are also connected to 3.3 V pullup resitor.

I have two self made breakout boards with a TLE493D-A2B6 (TLE493DA2B6HTSA1 by digi key) and two TLE493D-W2B6 3DSense Shields2Go from Infineon(TLE493DW2B6MS2GOTOBO1 from Mouser).


I had added a "startup" delay in the init() procedure and when removing it worked better, but not 100% either. Also, I feel that it works better if they are both the same sensors and not A2B6 with the W2B6.

I will measure it with an oscilloscope to look at the voltage waveforms as well and check the link on Monday.

 

Best Regards and have a nice weekend

Michael

0 Likes

Hello.

According to Infineon datasheet at Digikey for TLE493DA2B6HTSA1, the I2C address is 0x6A/0x6B for write/read.  This does not match the 0x22 nor 0x35 addresses previously mentioned.  This is likely the reason the device is not responding.  And the addresses  for W2B6 are also not matching 0x22 nor 0x35.  So, I'm confused how any of this has been working for you.

I also agree with Motoo.  Power-off then delay then power-on then delay, cycle may get the devices in a better state.

MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I'm just curious, but do we need power on the sensor before the initialization?

I wonder if you modify the code something like below, will it make things better?

    reset();
        // Power Off / Power On the TLE493D
    VDD_sensor_Write(0);
    CyDelay(1) ; // 1ms delay 
    VDD_sensor_Write(1);
    CyDelay(100) ; // 100ms wait sensors' HW intialization
 
    // Now initialize PSoC's I2C interface
    TLE493D_Init(TLE493D_AW2B6_I2C_A1_ADDR);
    CyDelayUs(150); // Small Delay
    TLE493D_Init(TLE493D_AW2B6_I2C_A0_ADDR);

 

In case I'm missing the point, I'm sorry.

moto

 

 

lock attach
Attachments are accessible only for community members.
Michael_K
Level 3
Level 3
25 replies posted 10 likes given 50 sign-ins

Hello everyone,

sorry for the double post, but I thought I forgot to hit the submit button and didn't realize the post still needed to be activated.

Thank you so much for the response.

@BiBi_1928986  I know, that the sensor with the ending A0 has the address 6A/6B, but the PSoC Creator use the 7-bit address for the SCB  like the wire.h lib for Arduino. So I use the address 0x35 instead of 0x6A and the address 0x22 instead 0x44.

 

@

With the oscilloscope you can see that the signal is noisy, but I think it has nothing to do with that. My guess is that it has something to do with the interrupts. The interrupts come approx. every 1.1 ms.
Also, I need something to keep the program from hanging. I need a status message back.

In the attachment you can find the source code of the i2c part with the sensor. 

 

 

Best Regards

Michael

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

The order of of configuration is important because also in the user manual it is written that the configuration is done sequentially. I can not supply both sensors with voltage, because otherwise they are addressed by the same address at the same time. So you have to configure one first ant then you switch the second sensor on and configure it.

Oh, I see!

But then, is VDD_Sensor_Write() controls only the second sensor or both?

May be you need to have VDD for each sensors. Or I would connect the first sensor to the VDD of PSoC, and provide VDD for the second sensor from a GPIO so that I have control over how long the program can wait till start up the second sensor.

moto

0 Likes
Michael_K
Level 3
Level 3
25 replies posted 10 likes given 50 sign-ins

Hello Moto,

the setup looks like this.

Michael_K_1-1638197861613.png

 

One sensor is always on and one is switch of for the configuration of the first one.

Best Regards

Michael

MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Dear Michael-san,

Nice diagram!

And that is exactly one of the methods I was thinking of!

Then I noticed that from your description, the sensor requires 5mA,

and I checked the PSoC 4200 Datasheet, there I could only found the absolute maximum current of +/- 25mA.

So it seems that the pins have enough current capacity.

But then when I checked in the PSoC Creator's component configure dialog,

It seems that an output pin seems to provide up to 4mA, which may not be enough for the sensor.

001-output-config.JPG

Although I'm not quite sure if this is a recommended method, 

but how about using one more pin to provide power to the second sensor?

 

And also, still I would think that the delay after  initialize the first sensor and power up the second sensor should be some what longer then us range, I would put 100ms or so.

 

Best Regards,

30-Nov-2021

Motoo Tanaka

0 Likes
lock attach
Attachments are accessible only for community members.
Michael_K
Level 3
Level 3
25 replies posted 10 likes given 50 sign-ins

Hello Motoo,

sorry for my late response.

 I started from the values in the data sheet and like you I saw something about 25 mA. Which pin has more power? I had removed the delays, because it came then increasingly to freezing. I will still try a bit with the source code, what could still bring improvement.

I have made a few tests.

Without a sensor, the programm runs normally and does not freeze. The addresses are still requested from the microcontroller, but it has no influence, because there are no sensors.

 

With one sensor it make no difference whether the 3.3 V pin or a GPIO pin supplies the sensor with voltage. What make a difference was if I initialized the LIN bus first and then the sensors or the sensors first and then the LIN bus. If I initialize the sensors first, the it runs without problems even after x resets without getting freeze. If the program freezes, than it is at the while-loop, in the write and read function, as shown in the example source code.

The same happens when I want to debug the program. If I want to execute single steps, the program freezes at the reset function or init function, but if I make the breakpoint after the init() function, the program runs and I can continue debugging normally.

 

voidTLE493D_WriteReg(uint8 i2c_addr,uint8 Reg,uint8 value)
{
    uint8 Write_Buf[2] = {0};
    Write_Buf[0] =Reg;
    Write_Buf[1] =value;
 
I2C_1_I2CMasterWriteBuf(i2c_addr(uint8*)Write_Buf,2,I2C_1_I2C_MODE_COMPLETE_XFER);
    while((I2C_1_I2CMasterStatus() &I2C_1_I2C_MSTAT_WR_CMPLT)==0){}
    return;
}

 

As you can see in picture 1, it works much better if the sensor and then the LIN bus is initialized. The second picture shows, when I first init the LIN Bus and then the sensor. On the SCL line I have then interrupts every 1.2 ms. 

I tried it with 2 different I2C buses and it worked without the program freezing (bild06)

 

To the pictures.. The narrow lines are the communication on the I2C bus, the somewhat larger distances after a HIGH are the resets and in red circled I have, if it hangs

 

Thank you for your answer.

Best Regards

Michael