 
#PineCone #BL602 @ThePine64 tested OK with #BME280 over #SPI ... Here's the wiring that doesn't light up the WiFi LED 💡
https://github.com/lupyuen/bl_iot_sdk/blob/spi/customer_app/sdk_app_spi/sdk_app_spi/demo.c#L76
#PineCone #BL602 SPI works OK yay @PINE64 ! Had to change SPI Phase from 0 to 1 ... Which doesn't sound logical 🤔
https://github.com/lupyuen/bl_iot_sdk/blob/spi/customer_app/sdk_app_spi/sdk_app_spi/demo.c#L129-L182
Getting desperate with #BL602 SPI ... Let's try to dump all BME280 Registers ... And see what works
https://github.com/lupyuen/bl_iot_sdk/blob/spi/customer_app/sdk_app_spi/sdk_app_spi/demo.c#L129-L182
#PineCone #BL602 #SPI Unsolved Mysteries ... 1️⃣ Why are the SPI Data Pins flipped? 2️⃣ Why does Pin 0 light up the WiFi LED? 🤔
https://github.com/lupyuen/bl_iot_sdk/blob/spi/customer_app/sdk_app_spi/sdk_app_spi/demo.c#L54-L115
Here's how we control #BL602 #SPI Chip Select Pin ourselves ... Using plain old BL602 GPIO
https://github.com/lupyuen/bl_iot_sdk/blob/spi/customer_app/sdk_app_spi/sdk_app_spi/demo.c#L47-L128
Nope #BL602 #SPI HAL can't control Chip Select Pin by #GPIO ... Because it has already configured the pin for SPI Port earlier ... Let's control the pin ourselves 👋
https://github.com/lupyuen/bl_iot_sdk/blob/spi/components/hal_drv/bl602_hal/hal_spi.c#L98-L122
Thankfully #BL602 SPI HAL lets us use GPIO to control the Chip Select Pin ... But we have already configured the pin for SPI Function ... Will this conflict with the GPIO Function? 🤔
https://github.com/lupyuen/bl_iot_sdk/blob/spi/components/hal_drv/bl602_hal/hal_spi.c#L479-L519
Ugh #BL602 is disrupting the two SPI Transfers ... By setting the Chip Enable Pin high ... Let's control Chip Enable Pin ourselves with GPIO
https://github.com/lupyuen/bl_iot_sdk/blob/spi/customer_app/sdk_app_spi/sdk_app_spi/demo.c#L70-L114
LA2016 Logic Analyser comes in this beautiful inspirational box ... "Embedded Development Kit: Innovative concept, win-win cooperation"
Nope #BL602 still receiving garbage from BME280 ... Let's do the #SPI Logic Analyser!
https://github.com/lupyuen/bl_iot_sdk/blob/spi/customer_app/sdk_app_spi/sdk_app_spi/demo.c#L70-L114
Let's try 2 #BL602 SPI Transfers instead of 1 ... First SPI Transfer transmits Register ID ... Second SPI Transfer receives the result from BME280
https://github.com/lupyuen/bl_iot_sdk/blob/spi/customer_app/sdk_app_spi/sdk_app_spi/demo.c#L70-L114
#BL602 SPI Data Pins seem to be flipped ... Based on SPI data sniffed by Logic Analyser 🤔
https://github.com/lupyuen/bl_iot_sdk/blob/spi/customer_app/sdk_app_spi/sdk_app_spi/demo.c#L49-L67
Logic Analyser captures SPI Data between #BusPirate and #BME280 ... So cool! 🤩 Now to capture #BL602 + BME280 and compare
...But now we get pretty Blue and Red Lights on #PineCone #BL602! 🤩 Time to do the SPI Protocol Analyser ... My first time ever!
https://github.com/lupyuen/bl_iot_sdk/blob/spi/customer_app/sdk_app_spi/sdk_app_spi/demo.c#L49-L67
IoT Techie and Educator / Apache NuttX PMC