AltSoftSerial with SPI

Hi everyone, quick question that I tried searching, but couldnt find a definitive answer…

Im working on an Uno-based project that has bluetooth via an HM-11, and CAN bus with an MCP2515. This will be a custom designed PCB.

One idea I had is connecting the HM-11 to the Uno’s hardware UART (add some movable jumpers, so I can reprogram the Uno, and then flip the jumpers over when the program needs to be run).

But then I wouldnt be able to debug…so I was thinking of adding a separate header/breakout on the board and use the AltSoftSerial library just for debugging with my PC when working on the initial setup and configuring of the sketch.

The “finished” unit wouldnt need debugging output, mostly I would just be using it to check that the Uno is properly receiving data from the HM-11 when writing the initial sketch.

Then once its finalized and working, I wont need to even use the AltSoftSerial anymore so I can make a “final” sketch with AltSoftSerial deleted.

According to the AltSoftSerial documentation, it says PWM on pin 10 is no longer available, “but it can still be used as a regular digital I/O”.

Pin 10 is obviously also the hardware Slave Select pin when you use SPI on the Uno.

My big question is, does the AltSoftSerial library mess up SPI, and have any conflicts when pin 10 is set to be the Slave Select with SPI in use???

Thanks
Ben

No. It's just using the timer that would have handled the PWM. It doesn't affect the pin itself.

duramaxhd:
Pin 10 is obviously also the hardware Slave Select pin when you use SPI on the Uno.

My big question is, does the AltSoftSerial library mess up SPI, and have any conflicts when pin 10 is set to be the Slave Select with SPI in use???

Not 'obviously'

You can use other pins for SS on SPI devices, just leave pin 10 as an output.

srnet:
Not 'obviously'

You can use other pins for SS on SPI devices, just leave pin 10 as an output.

Ahh ok thanks for the correction. A while back I designed an old circuit that used SPI, and tried using pin 10 as a digital input for something. The SPI slave select I had set as another pin, just because the location of Pin 10 didn't work on my custom board.

I spent a couple hours trying to debug the stupid thing, trying to figure out why Pin 10 wasn't acting the way I wanted it to....before finally reading that its not a good idea to use Pin 10 as anything else other than Slave Select when SPI is active.

But apparently I misunderstood, if SPI is active, you can use pin 10 as a regular digital OUTPUT, you just can't use it as an digital INPUT. :slight_smile:

In any event, as long as using AltSoftSerial still allows normal use of Pin 10 as Slave Select for SPI, I'm not worried about it.

thanks
Ben