logo elektroda
logo elektroda
X
logo elektroda

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

michalek002a 1665 10
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 19978534
    michalek002a
    Level 6  
    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
    khoam
    Level 42  
    Which library specifically? Link?
  • ADVERTISEMENT
  • #4 19978591
    khoam
    Level 42  
    In this one you actually can't without modifying its code. There is a clone of this library with the ability to set SPI pins in the ESP32, but it's quite old, so I don't know if it will work properly with the new Arduino Core.
    Link .
  • #5 19979007
    michalek002a
    Level 6  
    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
    khoam
    Level 42  
    sp->begin() is unnecessary. This is already done by radio.begin() with pre-set CE and CS values by the RF24 constructor.
  • ADVERTISEMENT
  • #9 19980185
    khoam
    Level 42  
    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?
  • #10 19980326
    michalek002a
    Level 6  
    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
    khoam
    Level 42  
    michalek002a wrote:
    but I decided that a nrf with a repeater would definitely have a longer range. I need about 1km.
    .
    Which amplifier specifically is being referred to?

Topic summary

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.
Summary generated by the language model.
ADVERTISEMENT