Guys,
I'm basically developing a hardware from bare metal... I mean this is not a Arduino shield or boards, but the hardware will be custom designed. The architecture is kind of arduino, actually from the point of view of software. I will use the IDE of Arduino.
Now, At this stage, I'm totally confused on the Arduino SS pin for SPI. Let me come to straight to the point:
-
Hardware will be based on mega2560.
-
It will have SD card and Ethernet both and both will be used via the SPI.
From my understanding, I found these:
- SD SS pin is D4 for shield.
- Eth SS pin is D10 for shield.
- D53 in mega2560 is the hardware SS
After reading and searching I found many info and really confused. Now I'm considering my understanding as follows:
- Always keep D53 to OUTPUT mode for SPI.
- When I will need to use the SD card, I need to Put the pin to OUTPUT & LOW of the card's CS pin (and as per the rule of thumb due to library, I can just use the D4)
- When I will need to use the Ethernet (Wiznet5100/5200), I can do the same, the D10 pin OUTPUT and LOW for the pin of Eth device's CS.
[Question 1] Now, as the device will work for both SD and Eth almost the same time (yeah, not simultaneous), then when i have to use the SD card, I need to first make the D10 (for eth disable) to HIGH. Again when I need to use the Eth, the opposite, D4 to HIGH.
[Question 2] If I'm not wrong, then do I need to make it LOW again once the job is done?? [Coz i found in a thread someone made a D10 high for SD init and then directly did the ethernet init...]
[Question 3] So as it will be a device that will be in a server mode (listening for connections) hence I can just keep the D10 LOW and when only and when it will need to write something in SD, I can temporarily make the D10 HIGH for eth disable and SD enable and then later I can just shift it back again just to keep ethernet continuously running right?
Thanks in advance!!
Mishu~