Page 1 of 1

Esp8266 SPI Slave interrupts

Posted: Mon Apr 24, 2017 10:14 am
by paraflou
Hi there,

Just burned micropython in esp8266 and it works great!

I ve been searching github and forums about spi interrupts in terms of micropython.

So far i get these:

1.
http://docs.micropython.org/en/latest/e ... /pins.html
At chapter 6.1 External interrupts it is clear that i can call irq method on o Pin object and set a callback function.

2.
https://github.com/micropython/micropyt ... rdware-API
I quote from IRQ section of above link
""" Peripherals that support interrupts provide the irq method which returns an irq object. This can be used to execute a function when an IRQ is triggered, or wake up the device, or both.
peripheral.irq(*, trigger, priority=1, handler=None, wake=None) """

3.
Of course i also checked http://docs.micropython.org/en/v1.8.7/e ... rules.html


My use case is:
I am building a multisensor device and i use esp8266 as a wifi module for my uC which is LPC4367. Lpc is used as spi master and esp8266 as spi slave. The spi interface that i am using is HSPI.
I leveraged c code examples for spi slave functionality and it is working fine but it is quite painfull especially for future added features.
I want to have bidirectional communication between master spi device (LPC) and slave spi device (esp).

In order to achieve above functionality when spi master sends sth to spi slave (esp) i want an interrupt raised and an isr to be triggered.

In c code spi_slave_isr_sta function needs to be impelemented to have this functionality. (Espressif official Esp8266 guide says so)

My question is:
Do i have to set irq to the pin that is for esp (slave spi) incoming data (mosi line) or i need an implementation of spi irq?

I found that hspi has no implementation of an IRQ so far. Is this right?


Thanks a lot in advace!