From fae7b954f62772bb1c9310ec8dbc6c915f90f100 Mon Sep 17 00:00:00 2001 From: recallmenot <104343143+recallmenot@users.noreply.github.com> Date: Sat, 29 Apr 2023 18:24:30 +0200 Subject: [PATCH] finish spi nrf24l01_tx readme --- examples/spi_24L01_tx/README.md | 36 ++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/examples/spi_24L01_tx/README.md b/examples/spi_24L01_tx/README.md index 551e357..6f60c9e 100644 --- a/examples/spi_24L01_tx/README.md +++ b/examples/spi_24L01_tx/README.md @@ -1,10 +1,10 @@ -# SPI DAC demo +# SPI nRF24L01+ demo This "example" consists of three parts: -a SPI Library for the ch32v003, a platform-agnostic library for the nRF24L01(+) and the actual example. +A SPI Library for the ch32v003, a platform-agnostic library for the nRF24L01(+) and the actual example. ## SPI library The SPI library helps you configure the SPI registers. -Initially the idea was to make it arduino-compatible but GPL. +Initially the idea was to make it Arduino-compatible but GPL. This is free-er. Currently, only master-mode is supported, either R+W or W-only. Then you can start talking on the SPI bus through SPI_read_x(), SPI_write_x() and, most importantly SPI_transfer_x(), where the x can be a 8 or 16 bit word (this is C, so no overloading). @@ -14,16 +14,17 @@ I welcome any improvements you may choose to make, it's far from complete or goo CRC, for example, is not implemented yet and I'm incapable of making DMA easy, as the spi dac example showed the processor can be mostly "braindead" and the tiny chip can still output loads of data. ## nRF24L01(+) library -This is the doing of NAME HERE, I've just included a copy of his LIBRARY here and made some modifications. +This is the doing of [Reza Ebrahimi](https://github.com/ebrezadev), I've just included a copy of [his library](https://github.com/ebrezadev/nRF24L01-C-Driver) here and made some modifications. ## example The example shows how to send either a uint8_t or a char[16]. To choose, move the comments. -The receiver-part is HERE, split in two because I don't know how to have the unified makefile recurse any differently. +The receiver-part is spi_24L01_rx, split in two because I don't know how to have the unified makefile recurse any differently. +You can enable / disable acknowledge mode by using "ACK_MODE" or "NO_ACK_MODE" in the call to nrf24_transmit(). ### nRF module Never connect the nRF module to 5V, it operates at 1.9-3.3V, much past that it will probably die! -Also, I've become convinced the briliant engineers at nordic are evil! +Also, I've become convinced the briliant engineers at nordic are evil!! Thanks to nordics specifications in the datasheet, the chinese module manufacturers don't even pack 100nF onto the board as bypass caps! Four hours of trouble-shooting later I stumbled upon the magic of adding a capacitor!! For you see, as the IC transmits its packets, it draws huge amounts.. wrong! @@ -32,13 +33,15 @@ To the VCC and GND pins I added a 33uF 16V each. Though a 10uF ceramic capacitor Can you imagine they saved 0.006$ and now we have to get out ye olde soldering iron so these work properly!! #### pinout for ch32v003 -Please check whether your module looks like THIS before using this pinout! +Please check whether your module looks like [THIS](https://www.circuitspecialists.com/content/552219/NRF24L01-RF-2.jpg) before using this pinout! perspective: looking at the underside of the module, pin header in the top right corner -VCC 3V3 GND GND -CSN/SS C0 CE C4 -MOSI C6 SCK C5 -IRQ NC MISO C7 +nRF | ch32 | nRF | ch32 +--------|---------|-------|------ +VCC | 3V3 | GND | GND +CSN/SS | C0 | CE | C4 +MOSI | C6 | SCK | C5 +IRQ | NC | MISO | C7 And then wire D4 to LED1 on the evaluation board. @@ -48,11 +51,12 @@ That's why there is a dir with Arduino files lurking in here on our christian se #### pinout for Arduino same perspective - -VCC 3V3 GND GND -CSN/SS 9 CE 8 -MOSI 11 SCK 13 -IRQ NC MISO 12 +nRF | UNO | nRF | UNO +--------|---------|-------|------- +VCC | 3V3 | GND | GND +CSN/SS | 9 | CE | 8 +MOSI | 11 | SCK | 13 +IRQ | NC | MISO | 12 And an LED on pin 4, for current-limiting resistor 1k is usually safe with 5V. -- GitLab