Hello,
I manufactured a PCB that uses a MEGA, 3 x max7219s, 7 segments among other things. The MEGA is mounted to the PCB via pin headers so I can't really change the pins around easily at this point. I am using the SPI library.
Each max7219 drives a series of their own 7 segments and are correctly connected to the clock (pin 52) and MOSI (pin 51) of the MEGA. Two of the max7219s and their 7 segments are working fine. The third one, however, is not. I made the mistake of connecting the load pin of the third max7219 to the MISO pin (pin 50) of the MEGA. My assumption is that this is the reason the 3rd set of 7 segments aren't working as I can't find anything else.
Since I have no use for MISO in this project, I was wondering if there was a way to disable just the MISO pin of the MEGA so that I can use it as a digital pin while still using the SPI library.
I tried editing the pins_arduino.h file like below, but nothing changed. Frankly, I'm not really sure what I'm looking at in the rest of the file.
I'd ideally like to test the circuitry as a whole before committing to a reprint.
Is there possibly a way to fix my mistake via coding? My last resort solution that I can think of is to physically scratch out the connection on the PCB and jerry rig the load pin to another pin on the MEGA.
Any help would be greatly appreciated.
Thank you!
#define PIN_SPI_SS (53)
#define PIN_SPI_MOSI (51)
//#define PIN_SPI_MISO (50)
#define PIN_SPI_SCK (52)
static const uint8_t SS = PIN_SPI_SS;
static const uint8_t MOSI = PIN_SPI_MOSI;
//static const uint8_t MISO = PIN_SPI_MISO;
static const uint8_t SCK = PIN_SPI_SCK;
Yes use an Exacto knife, razor blade knife, that kind of sharp cutting instrument to cut the trace and then run a piece of 30 AWG wire to connect the pin to the correct place.
As for using MISO when SPI is active - it is part of the built-in hardware for SPI transfers, I don't know that the pin can be directed elsewhere, I've never tried. SPI is just an alternate function of the pin, so maybe it can be used along side SPI.
Well I have an idea to try. MISO means "master in slave out" I can't guarantee it but it might save you some trouble. If your SPI device is a unidirectional output device, data on MISO will be ignored, and since MISO is an input with nothing driving it, you can connect some other output pin to it using a jumper. So, it will go to the LOAD and MISO, drive both the display input and MISO (which is also an input). Any SPI input will be garbage, but if the software ignores the input, it shouldn't create any problem. This would be much easier than cutting PCB traces.
Just be careful not to ever enable both MISO and whatever pin you choose for LOAD as an output, at the same time.
It would have been helpful to mention what the SPI device is.
aarg:
Well I have an idea to try. MISO means "master in slave out" I can't guarantee it but it might save you some trouble. If your SPI device is a unidirectional output device, data on MISO will be ignored, and since MISO is an input with nothing driving it, you can connect some other output pin to it using a jumper. So, it will go to the LOAD and MISO, drive both the display input and MISO (which is also an input). Any SPI input will be garbage, but if the software ignores the input, it shouldn't create any problem. This would be much easier than cutting PCB traces.
Just be careful not to ever enable both MISO and whatever pin you choose for LOAD as an output, at the same time.
It would have been helpful to mention what the SPI device is.
Brilliant. It works like a charm! Thank you very much.
scruffnut:
Brilliant. It works like a charm! Thank you very much.
Not really. I've just been doing this for a very long time... but you're welcome.