Hi
I'm struggling with using PB4 (SPI Slave Select) as an input in my current project. Unfortunately I did the PCB in a way that I need this pin working as an input for a standard tactile switch button.
I understand that in SPI Master mode when the SS pin is pulled low by external periphery, the SPI bus goes to slave mode. Subsequently in my software, the code tries to communicate via SPI with a DAC and that's where the whole thing freezes. I guess because the SPI bus is still in slave mode.
I already tried to do this, right after recognizing that the button has been pressed (i.e. PB4/SS has been pulled low):
SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR0);
also, I did set SS, MISO and SCK as a output, right after recognizing the button press.
Still, the firmware hangs as soon as it tries to communicate with the SPI DAC.
I do use the Arduino Framework.
Any ideas/ways how to do this without redoing the PCB?
Thanks!