Welcome, Guest

Author Topic: ESP8266 SPI connection with lua  (Read 4223 times)

Stinde

  • Newbie
  • *
  • Posts: 36
  • Karma: +0/-0
ESP8266 SPI connection with lua
« on: April 20, 2015, 04:24:55 PM »
Hi

I'm trying to read Honeywell pressure sensor with ESP8266.
http://sensing.honeywell.com/spi-comms-digital-ouptu-pressure-sensors-tn-008202-3-en-final-30may12.pdf

The transmission is only from pressure sensor to ESP8266, The sensor does't have MOSI pin.

Can anyone help and link or write example lua code reading the sensor. I have tried couple of days without succeess and I'm running out of ideas.
I have tried all SPI setup combinations with and without delay and dummy write before read.
Code: [Select]
cs=8
gpio.mode(cs,gpio.OUTPUT)
spi.setup(1,spi.MASTER,spi.CPOL_HIGH,spi.CPHA_HIGH,spi.DATABITS_8,0)
--tmr.delay(100)
--spi.send(1,00,00)
data=spi.recv(1,2)
print(data:byte(1,2))

BR,

Timo

digitalhack

  • Newbie
  • *
  • Posts: 4
  • Karma: +1/-0
Re: ESP8266 SPI connection with lua
« Reply #1 on: June 02, 2015, 02:52:11 AM »

Timo,

I realize that you posted this over a month ago but I wanted to know if you were able to make any progress.

I too am having problems with MOD-WIFI-ESP8266-DEV and SPI.  I haven't tried from LUA but I have tried both using the Arduino like libraries and also using a library developed especially for the ESP8266.  I have tried to access both an SD Card and a Nokia 5110 LCD with no success.  In both cases I was able to get essentially the same code working on an Arduino before porting it over to the ESP8266.

The only thing that I have been able to get the ESP8266 to talk to via SPI was an Arduino I setup in slave mode.

Any thoughts you or anyone reading this might have I would appreciate.

Thanks,

digitalhack

Stinde

  • Newbie
  • *
  • Posts: 36
  • Karma: +0/-0
Re: ESP8266 SPI connection with lua
« Reply #2 on: June 02, 2015, 07:52:50 PM »

I gave up and changed to a I2C version of the sensor. No problems with I2C and LUA.

Timo

digitalhack

  • Newbie
  • *
  • Posts: 4
  • Karma: +1/-0
Re: ESP8266 SPI connection with lua
« Reply #3 on: June 03, 2015, 05:12:48 AM »

Timo,

Thanks for the feedback and good to hear that I2C works under LUA.  I have ordered a couple of additional SPI chips and another flavor of the ESP8266 to see if I can make any headway with SPI.  I will post what I find out.

Cheers!

digitalhack