Interrupts and SPI on Arduino Nano

For general Flowcode discussion that does not belong in the other sections.
Post Reply
pmgreene01
Posts: 35
http://meble-kuchenne.info.pl
Joined: Sat Jul 08, 2023 7:39 pm
Has thanked: 3 times
Been thanked: 4 times

Interrupts and SPI on Arduino Nano

Post by pmgreene01 »

I started writing this as a help request, but I found the solution, so I figured I would post my experience in case it might help someone else.

I am using an Arduino for a simple analog servo. I sample an analog input and an analog sensor, perform a servo calculation and then send the output to an external DAC chip (MAX5216) over SPI.

Since I have started working on this, everything has been working well. Last week, I started analyzing my code to get the interrupt routine to run faster. I noticed that when I set up my SPI master, I chose the "Software" channel instead of "Channel 1". When I chose "Channel 1" it did run much faster.

The problem I encountered is that everything worked fine when I had the USB cable attached and downloaded the program. But the program would hang if when I powered cycled the unit with no USB connection. After further investigation, I found that it would get to the first SPI transaction and the program would hang (no signals on any of the SPI lines).

I found another post where someone mentioned adding a pullup resistor to my CS pin and that did work. With the pullup holding CS to +5V, everything works well after power cycling.

Post Reply