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.

AMC7836EVM: Python code

Part Number: AMC7836EVM
Other Parts Discussed in Thread: AMC7836,

Hi,


I recently purchased the AMC7836 Evaluation Module, however I wanted to stop being limited by the software provided in labview so I wrote a code in Python 3.7, which was implemented on a raspberry Pi that is used to control the AMC7836EVM. But I have had some doubts and problems reading ADC and Temperature.


The biggest doubt I have is when accessing the addresses to read the information from the ADC's or the temperature, this is divided into two addresses, Low Byte and High Byte, does it matter what order I access these addresses? If so, which one should I access first, Low Byte or High Byte?


I tried to change the order in which I access the addresses and the information I read is different, should this happen or am I doing something wrong?


One of the problems I have been having when reading the temperature is that sometimes the temperature that I read seems to be right, other times the temperature read is in the order of ~ 9º or even ~ 900º, which is clearly not right.

If anyone can explain my doubts I would be very grateful.


Thank you.

  • Hi Rui,

    Make sure that you are issuing a REGISTER_UPDATE command before reading the high and low byte.  Do not issue a REGISTER _UPDATE command between the two reads.  If you are still getting un-reliable data, I suspect you could have misformatted the SPI frame. You might want to confirm the format is correct with an oscilloscope or logic analyzer.  

    Thanks,
    Paul

  • Hi Paul,

    Thank you for your answer, unfortunately that is not the problem. I thoroughly revised my code to confirm that the REGISTER_UPDATE command was not executed between reading the low and high byte, and I didn't encounter any problems.

    As for the SPI frame, I also confirmed that it is correct. I have been using the xfer2 instruction from the spidev library to send the data and each word I send contains 8 bits, however yesterday by increasing the delay between each word sent I significantly increased the stability of the values read by the ADC's, and the stability temperature reading has also increased but still has some instabilities, now reading temperatures between 16º and 45º.

    Thanks,

    Rui

  • Hi Rui,

    Can you capture the SPI transaction on a scope or logic analyzer and share the results?  It could be an edge timing issue as well.  In addition, if you are fly-wiring the RPI to the EVM, then you might need to try slowing the SPI clock.  What frequency are you using?

    Thanks,

    Paul