I am using an ATMega1284P on a custom Bobuino board, with a RF24L01 radio module.
The module uses SPI and i have chosen to connect the CSN chip select pin to bobuino pin 29, which connects to ATMega1284P port C pin 7.
This port is named "PCINT23/TOSC2_PC7" and it corresponds to 1284 pin 29.
I need to use this pin to control the ON/OFF slave select of the RF module, so i have declared:
and use digitalWrite to set it HIGH or LOW. In the setup function of the Sketch i set pinMode and set it LOW so that it will be active.
My loop function is this:
Where receive and send are functions for radio communication. My program loops once fine and then the chip select goes automatically to HIGH and turns off my module. I tried using digitalWrite to set the CS pin back to LOW and i see that in the beginning of the loop (second time and every time after the second) and after running each radio function the uC tries to set the pin back to HIGH and for a fraction of a second it goes HIGH and then it's set back to LOW because i give the digitalWrite LOW command.
I can't seem to understand if the CS pin is set to HIGH by default (if it happens in all sketches) or if it has something to do with the 1284P internal pin being used for some other internal function.