logo elektroda
logo elektroda
X
logo elektroda

Connecting the nrf24l01 to the ESP32 via HSPI - changing the SPI pins (12,13,14)

michalek002a 3930 10
Best answers LABEL_AI_GENERATED

How can I connect an nRF24L01 to an ESP32 on HSPI and change the SPI pins from 18/19/23 to 12/13/14 in the RF24 library?

With the current RF24 library, you cannot change the ESP32 SPI pins directly without modifying the library code [#19978591] A reply says there is a clone of the library that supports setting SPI pins on the ESP32, but it is old and may not work with the current Arduino core [#19978591] Another reply points to the NRFLite issue 58 page for answers and example code about using alternate SPI pins [#19979019]
AI summary based on the discussion. May contain errors.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • Need to remap nrf24l01 to HSPI pins 12, 13, 14

    #1 19978534
    michalek002a
    Level 6  
    Posts: 357
    Help: 8
    Rate: 73
    Hi. I'll say right away that I'm not using ESP-NOW, I'm using nrf because it has a longer range and I want to use HSPI rather than VSPI because nrf is handled separately by the second core and there are other chips connected on VSPI.

    And the question is actually short. How do I connect the nrf24l01 and change the SPI pins in the program from 18,19,23 to 12,13,14 so that the rest of the devices work on VSPI? I have seen in the RF24 library that there is no such possibility provided.
  • ADVERTISEMENT
  • #2 19978570
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #4 19978591
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • HSPI setup with SPIClass and radio.begin()

    #5 19979007
    michalek002a
    Level 6  
    Posts: 357
    Help: 8
    Rate: 73
    And isn't there some way to simply swap the VSPI pins for HSPI in the library, maybe some minor changes would suffice? I looked for it myself, but couldn't get my head around it. I found some more example code like this, but it doesn't want to work in my case:
    Code: C / C++
    Log in, to see the code
    .
  • ADVERTISEMENT
  • #7 19979048
    Anonymous
    Level 1  
  • #9 19980185
    Anonymous
    Level 1  
  • #10 19980326
    michalek002a
    Level 6  
    Posts: 357
    Help: 8
    Rate: 73
    khoam wrote:
    michalek002a wrote:
    I say right away that I don't use ESP-NOW, only nrf because it has more range
    .
    Have you tested ESP-NOW with an external antenna attached to the ESP32? Do you need more than 100m?

    I haven't dealt with ESP_NOW yet, but I figured the nrf with amplifier would definitely have a longer range. I need about 1km.
  • #11 19980612
    Anonymous
    Level 1  

Topic summary

LABEL_AI_GENERATED
The discussion revolves around connecting the nRF24L01 module to an ESP32 using HSPI instead of VSPI to accommodate other devices. The user seeks guidance on changing the SPI pins from the default (18, 19, 23) to (12, 13, 14) in the RF24 library, which does not natively support this feature. Suggestions include modifying the library code or using a clone that allows SPI pin configuration. A code snippet is provided to illustrate the setup, but it is noted that the `sp->begin()` call is unnecessary as `radio.begin()` handles initialization. The user also expresses interest in achieving a range of about 1km with the nRF module and mentions the potential use of an amplifier.
AI summary based on the discussion. May contain errors.
ADVERTISEMENT