Electronic – arduino – Can Arduino MISO be set as output

arduinogpiospi

So I designed a PCB which consists of an atmega328 controlling a digital potentiometer (MCP4131) using SPI. I stupidly connected the pot's i/o to the MISO (master in, slave out) pin on the arduino instead of the MOSI (master out, slave in) pin. The SS and SCK pins are connected correctly. Needless to say, I haven't been able to make the pot behave as it should, because i can't get the arduino to talk to it.

I tried going into the Arduino SPI library and, in the function begin(), changing the line

pinMode(MOSI,OUTPUT);

to

pinMode(MISO,OUTPUT);

But, this doesn't do the trick. On my scope, I can see the bits being sent when the pot is hooked up properly (on my breadboard). If I could rip up the trace on my PCB and solder a jumper to the right pin on the arduino, that would be a fine workaround. But I'd rather be able to do it in software.

I don't have much experience with SPI. I'm currently researching it but haven't found anything useful on the web. Any thoughts on making the MISO pin switch to "MOSI"?

Best Answer

The Arduino shiftout() is a software/bitbanged spi implementation. You can use that instead of the spi library.