Author Topic: SPI bit banging; MCP3208; Raspberry;error  (Read 1159 times)

0 Members and 1 Guest are viewing this topic.

Offline Vindhyachal.taknikiTopic starter

  • Frequent Contributor
  • **
  • Posts: 490
SPI bit banging; MCP3208; Raspberry;error
« on: July 14, 2015, 04:09:57 pm »
1. I am using raspberry pi 2 board with raspbian loaded. need to do SPI by bit banging & interface MCP3208.
2. I have taken code from here, it is written for MCp3008(10 bit adc):
https://github.com/raspberrypi-aa/raspberrypi-aa/blob/master/spi_bitbang_test.py

3. Only change i had made in code is instead of calling
adcValue = recvBits(12, clkPin, misoPin)

I had called
adcValue = recvBits(14, clkPin, misoPin)

Since have to receive 14 bits of data.

4. Problem is code is not working. It keeps on sending random data ranging from 0-10700. Even though data should be max 4095. It means I am not reading data correct.

5. Problem which I think is since MCP3208 has max freq = 2Mhz , but in code there is no delay between two consecutive data read or write. I think I need to add some delay of 0.5us whenever I need to transition clock sicen I am operating at 1Mhz.

6. For some delay I am currently reading these:
https://projects.drogon.net/accurate-delays-on-the-raspberry-pi/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf