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.

TMAG5170-Q1: TMAG5170-Q1

Part Number: TMAG5170-Q1

Hi,

I am interfacing the sensor with FPGA to read the data in continuous mode, but the data read from the sensor is not changing after each time, its almost the same.

The scenario is same in trigger mode too. Can someone tell me y is this?

Is there any other configuration missing?

Regards

Athira

  • Athira,

    Thanks for reaching out.  It sounds like you have not enabled any magnetic channels. The device allows for custom configuration of the conversion pattern using MAG_CH_EN in the SENSOR_CONFIG register, and this is set to OFF by default:

    Thanks,

    Scott 

  • Hi,

     I did enabled the channels and I am able to read the values. But I am not able to get enough samples. Like If I do two reads, the data is same. Its not changing. The two reads give same data.

  • Athira,

    I understand.  If the device is in active measure mode, then it should trigger the start of a new conversion each time a full conversion is completed.  If the output is read again during this time I would expect to see that there is no update.  Can you confirm that the output is constant over a larger number of samples or with a long pause between reads?  

  • If you see the image, the data is  captured but if I am reading again, the value is not changing

  • Athira,

    In your capture I can see small changes between each read, but it also looks like you may be changing registers between each read.  Trying to match up to the read which starts at your marker, it appears that the read near 12.5 is the same register with a small variation in the result.  It might be easier to follow with a hex code for each transaction on MISO and MOSI.

    Can you describe the input you are providing to the device and the expected change to the magnetic field for your test?

    Can you provide your register settings?

    Thanks,

    Scott

  • Hi Scott,

    Yes, the magnetic channel x and y is enabled with continous Mode. The data is read from x and y channel alternatively. Conversion average is Default.

    Regards

    Athira

  • Athira,

    Sorry for the delay.  We had an extended weekend for Easter weekend.  What are your magnetic inputs?  How are you altering the magnetic field between reads?

    Thanks,

    Scott

  • Hi Scott,

    I also had an extended weekend.

    I am just hovering the magnets over the sensor to read data. I guess as I am doing the read at the same time, the data read is also same. If I put a delay between the reads do you think the values will be changed?

    Regards

    Athira

  • Athira,

    Yes.  Right now your reads are happening with a 500 us delay between them. What might be an easy way to first verify is to run the test with a magnet present, and then run it again without the magnet.  You should see a significant change in the field observed by the sensor.

    Thanks,

    Scott

  • Hi Scott,

    yes I am able to see a significant difference. But what I need is some samples with different values to obtain a plot just like we get when we use the evaluation kit

    Regards

    Athira

  • Athira,

    Absolutely.  This step was to confirm you are successfully reading from the device.  From here you should be set to start capturing more data to piece together for this purpose.  Depending on the duration of travel for your magnet, you will want to either space out your samples, or increase the total number used for your calculations.  In the case of the EVM, it defaults to 1000 samples, over a total timespan of about 75 ms.  After a few tries, I was able to get a clean capture using a fixed number of samples on the EVM using your settings with the following plot 

    Here, I'm using a fairly strong magnet and moving the magnet pretty quickly by hand.  I was able to capture most of my motion during the 75 ms interval.

    If I move more slowly, the response shows much less change

    From sample to sample the X output is only changing by 360 uT during the linear portion of the capture in the second plot.  

    You should also find that larger magnitude magnetic fields will produce greater magnitude changes with small position changes.  This may be the result of using a stronger magnet or by placing the magnet existing magnet closer to the sensor.  Had I used a smaller magnet further from the sensor, I would anticipate the change observed from point to point to be even smaller.

    Thanks,

    Scott

  • Hi Scott,

    yes I think it seems to be working fine.

    Thank you.

    Regards

    Athira

  • Hi Scott, I tried to use trigger to capture data every 500 us. I used cs pulse as the trigger. But the data I obtained is not as I expected.

    Can you look into the picture below?

  • Athira,

    It appears that the line marked "cs_.." is your clock, and I do not see the trigger signal for the CS pin.  Else, it appears you are triggering CS much faster than the 500 us read rate.  I generally see you have changing output codes, but do not know what registers you are reading. Can you be more specific about the problem?

    Thanks,

    Scott

  • Hi Scott,

    I am reading the x channel output with cs as trigger, and I used a data valid signal to capture the samples all together. The samples are changing but the change is abrupt.

  • Athira,

    The output code is a 2s compliment to support +/- sensing range.  

    So with very low level input, or inputs that are changing between + and - values, it is likely to see a step between 00 and FF.  

    Also, in trigger mode, please be aware that with CS trigger, it will initialize and start the conversion when CS is low.  you are leaving enough initialization time + conversion time before capturing outputs for each conversion

    For two axis sampling in active trigger mode this should be about 85 us, which is well under your 500 us delay.

    Thanks,

    Scott

  • HI Scott,

    I have one more doubt, the cs trigger starts when cs goes low right? So the trigger is just the low transition or the entire cs low pulse? So if I give next cs after 500 us of the first cs pulse transition, this is fine  I guess

    Regards

    Athira

  • Athira,

    There are two trigger modes that depend on the CS signal, and they behave differently:

    For TRIGGER_MODE = 0b01, the trigger is defined to start as a low pulse.  In this case there is no need for SPI transaction.  The second option that relies on CS is TRIGGER_MODE = 0b00 to trigger using SPI.  This is initiated using the CMD bits of the device.

    When using this mode, CMD0 may be set so that the device will begin the next conversion at the completion of the write command; when CS is returned to the high state.

    Thanks,

    Scott

  • Hi Scott,

    I am using the 00b1 mode, so the trigger will be set when the cs pulse goes low, and the conversion starts at the low pulse of cs, Am I right? And in this mode, there is no need of SPI transaction which means sent the command to read the data from the output channel once and then change the cs , is that what you meant?

    Regards

    Athira

  • Athira,

    If desired, you may trigger a conversion by pulsing CS low without sending any clock or data.  However, during any normal read/write transaction, if the device is not already running a conversion, driving CS low to initiate the SPI transaction will start the next conversion.  If the device receives trigger input during any active conversion, the trigger is ignored. 

    In the case you showed above, it appears you initiate a SPI command every 500 us, which would start a conversion during the read.  The read should complete before the conversion result is ready. The result of your conversion will be ready prior to the next read, however.  This means you will have a fixed 500 us latency between actual position and when data is received by the MCU.

    Thanks,

    Scott

  • Hi Scott,

    The device was working perfectly, but sometimes the miso data shows CRC error in the previous frame, I have disabled the CRC check but sometimes it still shows the error, Can you please tell me y is that?

    Regards

    Athira

  • Hi Scott,

    Now it is always like this. Crc error is always shown. I did not change anything but suddenly this happens. 

  • Hello Athira, 

    Just to give you a heads up, Scott is out of office today but will be back tomorrow to help you with your question. 

    Best Regards, 

    Justin Beigel

  • Hi Scott,

    The error is solved now. Thanks for the help.

    Regards

    Athira

  • Hi Scott,

    I have the magnetic field values, but there are some jumps in the values which is not expected. The magnet is staying still. Please look the picture below.

    Regards

    Athira

  • Athira,

    I am not able to understand exactly what I am seeing.  Are you able to provide the results in a tabular format?  How large are the unexpected jumps that you are reporting?

    Thanks,

    Scott

  • Hi Scott,

    In here there is no magnet present, but the waveform is like this. There is a jump 65523 to 32768(decimal)

    Regards

    Athira

  • Athira,

    These jumps are happening approximately every 0.5 ms, which is your read rate from before.  The code 32768, is 1/2 of 2^16. This appears to me to be the data in your controller being reset each time you initiate a read. Once the data is acquired from SPI, it then remains stable at the actual read value of 65523 which is close to 0 mT. 

    Thanks,

    Scott

  • Hi Scott,

    But the shift is not happening when I place the magnet, its coming correct

    Regards

    Athira

  • Athira,

    The output code is a 2s compliment format, are you doing any processing of the result to account for this?

    With noise and offset, I would not be surprised to see the output vary from just above 0 to just below 2^16.  For your case, it appears you have the just above 0 value offset by 2^15.  

    You might be able to test this by slowly moving the magnet above the sensor in this fashion:

    Depending on how straight you are able to do this, you should be able to produce a plot similar to the green line.  It might require rotating the magnet 90 degrees based on the axis you are reading.  The green plot is the result of presenting both a positive and negative field during the motion.  You should observe the positive region to all be greater than code 0, and the negative region to be less than 2^16. Unless you are saturating the inputs, you should not be near the midcode value.

    Please check to make sure you don't see an issue with both polarities.

    Thanks,

    Scott

  • Hi Scott,

    Yes I am doing the conversion. This is the converted result . I did not rotate the magnet, I just moved the magnet away. But the graph is good with magnet.

  • Hi Scott,

    But the value is not reading positive, its always negative.

    Regards

    Athira 

  • Athira,

    Please double check your conversion calculation, and how the 2s compliment is being logged.  With no magnet, you should measure very close to 0 mT for all readings, but it is possible the sign will change due to noise fluctuations.  In this event there should be large steps between 0 and 65536.  Instead you are seeing large steps between 65536 and 32768.

    The suggestion to move the magnet horizontally above the sensor was to help produce an input with both positive and negative fields, as a debugging effort to help identify any possible errors in the calculation.  

    Thanks,

    Scott