1 hour later…
Now I looking at the nRF24 library more closely, version 0.5 of nRF24 learning notes: penzu.com/public/09bf5314. There are a couple of reasons: I hope to: (1) Modify the big library to make a smaller and simplified version, for easy troubleshooting, (2) Modify some basic functions to make them more newbie friendly.
1 hour later…
Now I am reading the nRF24 Library’s SPI setup method and found a big problem: SPI1 is NOT supported, module B is also NOT supported. I forgot what is the difference of SPI between Model A and Model B, but I will definitely be using Rpi4B (and perhaps also Rpi3B+ later. I remember the library is using a spidev compiled in its setup procedure. Since the library is NO longer supported by the author.
So I feel uncomfortable to use this old SPI method for Rpi Model A only, with the old complied spidev. My decision is to use Rpi4B buster (2019sep26 release)’s preinstalled SpiDev, which has many more (six, to be precise) SPI channels (or buses, I forgot which term I should use :))
Rpi4B’s six SPI channels is too messy, and too easy to go wrong. So I think I better be humble and use only two of the six, ie, SPI0, SPI1. And with three CS pins, I can control 5 nRF24 modules. I will also be using python’s “list” and “dictionary” data structure. So it should be “easy” to later to scale up to all six SPI channels.
3 hours later…
Now I am trying to build a minimal nrf24 library which consists of the very basic functions: (1) SPI setup, (2) nrf24 module configuration, (3) nrf24 register read write functions. With the above three basic functions, I can then config, and perform the nrf24 functions.
I am now do the top down design of the using the big library as a blueprint. The startup sections are in the top part of the following file: penzu.com/p/772fa292. Next step is reading the datasheet a couple of times and modify the template functions for nrf24.
The state diagram show TX mode and Rx mode. So I think I need to get a rough picture of what is TX and Rx modes.
Then we need to check out the register map to see which registers to config, which to give commands etc. I think I should start with the config register, never mind other not so important registers.
Then we need to read the command set to know how to load a message, how to send, how to receive etc etc.