...Wait it's still using the old terms. Should be renamed as "Controller" and "Peripheral", according to the guidelines:

oshwa.org/a-resolution-to-rede

SPI Registers are remarkably similar to I2C Registers ... So I can reuse my I2C code for SPI 🤔

github.com/bouffalolab/bl_docs

SPI DMA ... Lets you specify a Linked List of Transmit / Receive operations ... That will be executed by the DMA Controller

github.com/lupyuen/bl_iot_sdk/

"AOS" means "AliOS" ... So IoT SDK is actually built on AliOS! But no worries ... I can port the BL602 HAL to ... Without AliOS 😉

github.com/lupyuen/bl_iot_sdk/

But if AliOS is really a complete Embedded Operating System ... Why does IoT SDK still need FreeRTOS? 🤔

github.com/alibaba/AliOS-Thing

Another trap! "vfs_spi_init_fullname" doesn't return the SPI Device ... It passes the SPI Device to AliOS! Let's create our own function to init the SPI Port without AliOS 🤔

github.com/lupyuen/bl_iot_sdk/

SPI Data Transfer needs a "void *" parameter ... Which is cast to an "spi_ioc_transfer_t" ... That belongs to AliOS 😭

github.com/lupyuen/bl_iot_sdk/

Saturday night with my lovelies ... @PINE64 and BME280 ... Now connecting SPI

"hal_spi_dma_trans" hangs while doing SPI DMA transfer because it's waiting for a FreeRTOS Event Group ... Which is supposed to be signalled by the DMA Interrupt Handler. Let's comment out the waiting and see what happens...

github.com/lupyuen/bl_iot_sdk/

Commented out the waiting for SPI DMA ... Yep no more hanging ... But no SPI Data received. Interrupt Counters show that DMA Interrupts weren't triggered.

The plot thickens ... Just like my chicken soup 🤔

github.com/lupyuen/bl_iot_sdk/

Follow

SPI DMA uses a Linked List of DMA requests ... Let's dump the DMA Linked List and verify the SPI Transmit and Receive requests

github.com/lupyuen/bl_iot_sdk/

Aha SPI DMA is now Transmitting AND Receiving! The SPI Mode was incorrect ... Got confused between the AliOS docs and the BL602 implementation 🙁

Received SPI Data is garbage though 🤔

github.com/lupyuen/bl_iot_sdk/

...And why did the WiFi Light (top LED) switch on? 🤔

Logic Analyser captures SPI Data between and ... So cool! 🤩 Now to capture + BME280 and compare

qdkingst.com/en/download

@ThePine64 connected to BME280 and LA2016 Logic Analyser ... Let's sniff the SPI Bus and find out what's wrong!

Let's try 2 SPI Transfers instead of 1 ... First SPI Transfer transmits Register ID ... Second SPI Transfer receives the result from BME280

github.com/lupyuen/bl_iot_sdk/

LA2016 Logic Analyser comes in this beautiful inspirational box ... "Embedded Development Kit: Innovative concept, win-win cooperation"

Show newer
Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.