A weird SPI bug

Hi guys,
So basically i was working with the nrf24l01 module, it's a module that works with SPI. Now i kept the module plugged in while i was uploading my new sketches (it runs on 3V3, but 5V tolerant pins). At the early stages of the coding, every time i upped the new code, the module wouldn't do what i wanted it to do. So i kept reviewing my code over and over. After quite a few hours, i hopelessly tried unplugging and replugging the module's power pin just to see if it would make a difference, and magically, it started working! (talk about time wasted) I then tried isolating the problem.
Currently, my theory is that since the module is kept plugged while uploading the sketch, the ICSP data might be messing up the nrf24l01 registers. Now thing is that my chip select pin is on pin 4. From what i know pins are set as inputs while uploading new sketches. maybe the chip select is receiving noise and then random data flows in the module.
i was really just wondering if anyone with more knowledge on what actually happens during an upload could tell me if this is even possible? Or even if anyone else experienced similar situations, even with other SPI modules?

I was thinking about putting a transistor in between the ground pin of the module to disable it while upping. I can't seem to find a software reset in the datasheet (maybe the nrf24l01 doesnt have one?) Would anyone else have a simple fix to this? its not a big deal really, since in my final version project i wont be upping new sketches to it

Now thing is that my chip select pin is on pin 4.

Did you forget to include a pull-up resistor?

ah i didnt see that
I tried, it worked once or twice, but its still doing it
is the reset on the opening of the serial monitor same as the button reset?
after some more debugging, found out the problem was in fact in my code. Seems to be working now.
Just for the sake of the post, anyone ever had this problem before? I'll still attach a pull-up resistor to chip select though.


Alright, well in my future SPI projects, ill make sure to include that pull-up

I don’t use a pullup resistor on the SPI slave selects. I set all the SPI device slave select pins to OUTPUT and HIGH in setup.

void setup() {

// rest of your setup code

It has been suggested that all SPI devices should have a weak pullup on the SPI slave select, but it has not been implemented by Arduino or any other shield manufacturer AFAIK.