I have a simple program written by a friend of mine that monitors some input pins and sends a command via SPI. it works just fine on a Pro Mini, but I want to convert it to work on a Pro micro so i can get rid of the FTDI cable i need for the Mini, the pro mico of course having USB built in.
The boards are the same size, same number of pins. but the Micro has a couple of pins numbered differently. I THOUGHT all i had to do is to change the pin number in the code. but the code does not work.
So I tried an Uno R3 as i figured the pin numbers are the same. still doesn't work. I am missing something. I am not very good with writing code. can I entice anyone to help?
Start by posting your sketch, using code tags when you do
In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.
why did you not use the default Pro Micro SPI pins - see Pro Micro & Fio V3 Hookup Guide , e.g. MISO pin 14 MOSI pin 16 SCK pin 15?
e.g. when I connected a RFM95 LoRa module to a Pro micro I used
// Pro Micro with RPi HAT RFM95W
// Pro Micro SCK pin 15 to RFM95_pin SCK
// Pro Micro MISO pin 14 to RFM95_pin MISO
// Pro Micro MOSI pin 16 to RFM95_pin MOSI
// Pro Micro pin 8 to RFM95 SS /
// Pro Micro pin 4 to RFM95 Reset
// Pro Micro pin 7 to RFM95 DIO0
// Pro Micro pin 6 to RFM95 DIO1
I suggest you take a step back and implement a separate program to just test your SPI target module working with the Pro Micro
similarly test any other modules you wish to connect to the Pro Micro in separate programs
when all modules work with the Pro Micro start building your complete project code
make sure you select the correct Pro Micro version using Tools>Board, e.g. 3.3V 8MHz or 5V 16MHz - selecting the incorrect version can cause problems
The code posted is for the pro mini and it works fine. I changed the spi pin numbers before uploading it to the pro micro. But it still did not work. Also, yes I have the correct 5V logic version.
And BTW I did get the uno to work. I had one wire in the wrong place. So the code posted works on the pro mini and an Uno R3, I just can't get it to work on the pro micro.
after a lot of googling it seems Pro Micro's and SPI do not work well together. SS is connected to PIN 17 which is not brought out to a pad. instead it is connected to the RX LED. by connecting a wire to the Resistor that feeds the LED (IE the connection straight from the Chip) and setting SS in my code to pin 17 it works!
Your Pro Micro is acting as an SPI master, correct? Because the only time you really need /SS (Slave Select) is when you're using the chip as an SPI slave. As a master, you can use whatever pin you like for your slave's /CS. It's an entirely different thing than /SS.
well, I know just enough about this to be dangerous. as I said, a friend of mine who is far more versed in code writing wrote the code for me. I know just enough to upload a! sketch and make a minor change or two like pin numbers etc. i am FAR better with hardware.
I did a lot of googling, "Pro Micro SPI" brought up many posts about the issue. 2 post's caught my attention.
which shows attaching a wire to the Board for the SS connection.
for whatever reason, it now works!!!
I am REALLY curious now as I also ordered a couple of Adafruit Itsy Bitsy boards and the schematic for that board shows that the SS pin isn't connected to anything. I might not be able to use those for SPI. eh whatever. I am just happy that I got it to work and I can put the lid on this thing now and be done with it!!!
To help others. I have designed and created a Pro Micro Adapter board that serves 2 functions. #1 is a way to mount a pro micro in a project and #2 is to allow you to add a jumper to bring the SPI SS pin 17 out to a header for projects that need it!