-2

I'm using a 7200 board from Embedded Arm. The board hosts the linux kernel 2.6 and mount an EP9302 arm9. We need to use the SPI interface in order to communicate with an accelerometer (the LIS3DSH) and some PT100 (MAX31865).

Our approach to the problem is literally based on bitbanging the EP9302 registers like in this example provided by the Embedded Arm (file tempSensor.C at ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7200-linux/samples/). Note that the sensor in this case is "embedded" in the board itself. Finally we program in C.

Unfortunately all our attempts have failed. So question: Do you know how to use SPI on the EP93xx? Any code or example?

Andak
  • 124
  • 12
  • If I remember correctly, the LIS accelerometers don't follow the SPI de facto standard very well, but have various obscure timing specs. So if you have some generic standard SPI driver, it will probably not work. – Lundin Nov 17 '16 at 09:47
  • First of all thanks for the reply. I don't use SPI driver, i write directly in the microcontroller registers – Andak Nov 17 '16 at 10:19
  • 1
    What do you mean with _our attempts have failed_. Are you testing the spi output? data are sent correctly but no answer form slave device? No data output? You should also post your efforts. Looking for complete solution is OT on SO. – LPs Nov 17 '16 at 10:23
  • Can we have some more detail on what you've tried, exactly? Also, have you tried contacting Technologic Systems directly? Their support seems appropriate for this question: https://www.embeddedarm.com/support/contact-us.php – Nerf42 Nov 22 '16 at 18:15

1 Answers1

0

Ok guys Thanks all for the suggestions and tips. I resolved my problem. Due to the fact i was not using drivers but i was bitbanging bits directly in the micro register I had a collateral effect: -every time i write something in the SPI write register, the data are written in the MOSI and the data on the MISO are transferred in a FIFO buffer. It does not matter if the slave device reply or not! That was the problem

Solution: every time you write something in the SPI "output" register. Always read the FIFO "input" register. Always!

For istance, when I was configuring the slave registers I didn't read the input FIFO (the devices didn't reply BUT you shall always read (clean) the FIFO!).

I noticed the problem using an oscilloscope. Thanks for help. The example I provided in the question is working because there is always a "read" after a "write"!

Andak
  • 124
  • 12