-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] NRF24L01+ fails when using with MicroSD card. #692
Comments
It is important to manage the Chip Select pins properly when using 1 SPI bus for multiple SPI slave devices (in your case the SD card module and the nRF24 module are SPI slave devices). My first guess is the Chip Select pins aren't being managed properly. Looks like the fix in the link you posted bypassed the problem by disabling the level shifting chip on the SD card module via connecting the level shifting chip's Enable pin to the SD card module's CS pin. I would need to see the schematic for the level shifting chip and how it is soldiered into the SD card module's PCB to fully endorse this fix. What MCU are you using?Why are you using I2C? |
Hi, thanks for your reply. I'm using Arduino nano, CS pins are correct. NRF24 works correctly with accelerometer LIS2DW12 which also use SPI. NRF24 stop working when i connect MISO pin of Micro SD Adapter to the arduino. I'm using I2C to call ADS1115 in
|
Thanks for specifying the MCU.
ConclusionLook into the specs for your SD card and the datasheet for the level shifting chip on the SD card reader module. Prepare for a new level of confusion because the specs/datasheet for these devices will likely not share the same terminology. I'm starting to think that tying the level shifting chip's CE pin to the SD card module's CS pin might be the only fix. Your concern before making that hardware modification is a good habit. Since there doesn't seem to be a problem on the RF24 side of the application, I probably won't be of much more help to you. Feel free to keep posting progress/questions on this thread. |
Hi Brendan, I solved it by setting a dedicated SPI bus for de SD module using https://github.com/greiman/SdFat library. I followed the "SoftwareSPI.ino" example https://github.com/greiman/SdFat/tree/master/examples/SoftwareSpi. You have to change Here is my new code:
In the setup section include this
In the loop section nothing changes
Thank you fo your support. |
Well done!! If you are able to, you should copy this successful solution to that mysensor forum you linked to in the OP. Its probably a good tactic (in this particular scenario) to use the bitbanged SPI (AKA SoftSPI or SoftwareSPI) for the SD card since those things aren't exactly used for their "fast" I/O transfer speed. As for the nRF24, SPI timing is rather detrimental. Thank you for posting back (not many people do). Again, good job! |
Thanks Brendan! I tested velocities over Hardware SPI and SoftSPI. Hardware SPI can write data up to 168Hz while Software SPI up to 54Hz, arround 3 time slower. I wonder if there is a way to use SoftSPI on NRF24L01 modules that can read/write data over 100Hz. |
Well there is a bit in the RF24 docs about using SoftSPI, but it would be slower... I wouldn't recommend it because wireless throughput it often the "tighter" bottleneck in most projects. But you are free to experiment. As always, feel free to post your findings here! |
Now that I think about it, this RF24 library has introduced (since this issue was closed) a new feature to allow using secondary (or non-primary) hardware-driven SPI buses. But that still depends on if your MCU board has more than 1 SPI bus exposed. |
I've actually read that specifying SPI bus was an issue when using Raspberry Pi Pico. These does not include SoftSPI on Arduino Nano? |
I need more details to confirm this. Where did you find that info? The SoftSPI implementation likely won't work with the RP2040 because it wasn't written for that architecture. SoftSPI should work on AVR architecture (like Arduino nano) as long as the pins specified aren't the same pins used for hardware-driven SPI. |
Read that from you, sorry. The RP2040 exposes multiple hardware SPI buses, so we may have to chew on that a bit. |
oh. 😆 That shouldn't be a problem anymore; consider it chewed and digested. I'm now a bit more familiar with the PicoSDK now than when I originally made that comment. Actually, I was able to apply the overloaded- |
A way to fix it is making some changes to the board. You need to get rid of a resistor, cut some connection and wire from MISO pin to pin 7 DO of the SD adapter directly. It wasn't my idea but I followed the following tutorials which I give all the credit to: https://www.youtube.com/watch?v=_Q2pBEgoMN0&t=548s |
Sorry to ask here. This is not a library issue.
Hi, im trying to log and send aceleration data using NRF24L01+ (3.3v) and MicroSD (5V) modules. They are both working correctly separately but when i try both at the same time, NRF24L01+ fails.
i tried 2k ohm resistor in MISO line (see https://forum.arduino.cc/index.php?topic=507086.0) without success.
Also saw https://forum.mysensors.org/topic/6724/solved-nodemcu-esp8266-and-spi-with-nrf24l01-sd-card-module-sanity-errors/3 but i'm not sure if it applies to my problem. As this implies breaking the moduleI, befor i would like to know if ther are any other solutions. In my cases NRF24L01+ can be configured while not having MISO conected (obiously logging fails for this).
if it helps, her is my code:
The text was updated successfully, but these errors were encountered: