I often use Arduino Nanos with a DF Robot DFR0299 MP3 player, using software serial as the control signal between the Nano and the DFR0299. I have done this literally hundreds of times with one board design, and all is fine. I have another board design which uses the same connections for the DFR (Digital pin 10 for Transmit, 11 for receive, 1K resistor between the TX and RX pin on the DFR), but one that has all of the other pins used for inputs or outputs (with jumpers on D0 and D1 to allow USB programming), including all the analogue pins.
Now, the issue I've got is the arduino won't talk to the DFR using software serial when all of these other pins have connections to them (all the digital pins have mosfets on them to drive LED's). Anyone any idea why this might be? I've checked all the connections over and over again, and built the board twice, and I definitely haven't made a wiring mistake, and the DFR plays if you short the AD key 1 to ground, so that is working and reading the sd card.
I found in the past if you have something connected to D0/D1 when trying to upload a sketch, it fails. So, I put a jumper on the pins so they can be used as outputs after the sketch is uploaded. In this particular case, D0 and D1 aren't connected as the jumper is open.
Indeed. Hence the jumpers on it. In this particular case, I haven't bridged the jumpers, because I only need 5 outputs, but the board is designed for up to 12. If I need all 12, I'll need to change the program so it doesn't have any serial output, just software serial.
Yes, there is a 1A regulator which supplies the DFR and gives the logic voltage for the switches, the MOSFET controlled LEDs are all powered by 12V, as is the Nano. The DFR has a max output of 3W, so 5W should more than cover it (and does normally, on the board that works fine I run both the Nano and DFR from an external 1A 5V regulator).
Edit: Also, I can get the DFR to trigger and play a sound, by grounding one of the pins. It just won't talk to the Nano.
Sketch uses 6206 bytes (20%) of program storage space. Maximum is 30720 bytes.
Global variables use 449 bytes (21%) of dynamic memory, leaving 1599 bytes for local variables. Maximum is 2048 bytes.
So... @david_2018 mentioned about interrupts. I checked which pins the Nano used for interrupts (D2 and D3), found that whilst I had mosfets connected to those pins (via resistors, of course), they weren't actually then doing anything on this application, so removed the resistor, and hey presto, suddenly it will talk to the DFR.
Certainly a step in the right direction. However, now 2 of the outputs don't illuminate and it completely ignores all of the inputs....
So. I think, "Hey, what if I swap out the two suddenly not working outputs for two spare outputs, and remove those resistors too"...... And it worked!!
So. TLDR, if you are trying to use software serial (on pins 10 and 11), you CANNOT have anything connected to pins 2,3,9 and 12.
As the problem is solved, I only skimmed the thread, so maybe I’ve misunderstood. But that general warning surely cannot be right? I’m certain I’ve used one or more of those pins in my many DFR Player projects, as well as 10/11 for Rx/Tx.
Pin D12 may or may not be relevant tbh, I’ve later realised that I do have that one connected to the busy pin on the dfr299 on other projects. But pin 9 I’m sure is an issue, as the led I had connected as an indicator on that output always had a low glow to it, suggesting it is doing something. I don’t know if I had simply disconnected pin 9 whether pin 12 would have then worked ok, but whilst pin 9 was not floating, pin 12 would not output.
Edit: also, as above if I uploaded a sketch which didn’t use software serial, all inputs and outputs worked perfectly with what was originally connected.