I am doing a project with arduino mega, and just ran out of pins (which itself is pretty funny considering the amount of pins there).
Right now I am missing one serial port and 2 I/O-s
What the problem is -is that Arduino has some pins not mapped for software to use, but they are clearly there and not used (not even defined in the pin definitions table). What I mean is the greater part of Port J (only things mapped from there are Digital 14 and Digital 15 (PJ0 and PJ1) which are hardware uart pins.)
Since all of the uarts are all ready in use (or digital pins from uarts) I have a need to use PJ, that has PCINT on them for soft uart and GPIO.
Now, since I feel that I might not be the only one with this kind of problem (maybe now or in the future) it seems like those pins should be mapped from the default library. Yes, one can mod the standard library to work but it takes time which is something that people hope they do not need too much when choosing to do something with arduino.
Since I don't like working on the libraries themselves because of my lack of programming skills, Any tips on getting the ports work as gpio and soft serial would really be appreciated.
You can use direct pin commands:
bitSet (PORTJ, 4);
bitClear (PORTJ, 5);
int i = bitRead (PORTJ, 6);
However, the SoftwareSerial uses the Arduino pin mapping.
You could move the SoftwareSerial files into your project and rename the functions, and adapt those for your pins.
It will stay with your project, but you won't have the bug fixes and updates for the default SoftwareSerial.
Why does your design need all those pins ? What if you use PORTJ and still need more pins ? Perhaps a simple shift register or port expander solves al your problems. Perhaps you use a driver chip that can replaced by a driver chip with serial input. Perhaps you can use another ATmega chip for a seperate task.
When you need only RX for one device, and only TX for another, you can share a serial port.
I think the BeagleBone Black has 5 serial ports.
That answer would suffice for my problem as such, but it still remains that arduino has pins that are not usable from the IDE without bare C manipulation. From my point of view, this is a huge oversight.
Main idea is to get this problem out on the open so that someone who actually writes nice code can update the pin definitions table and interrupt service routines.
I will probably modify the libraries just so that i get to use all of the chip not just the headers or need to go to external translators. but that means that there might be problems with other parts of the library, thou the area I am interested in works.
Also never ever should any processor have any part un-used just because headers for those pins did not look nice on the composition of the board. That is just plain wrong just bring out the pads. Mega has more than enough room for that.
Project itself is a data collection device for a special purpose and making it in to mesh of wires and boards on wires on boards is not very useful. Before I go to prototype pcb I want to have this portable system tested for soft bugs. It is bad enough to iron one type of bug out instead of two.
And yes for me the soldering part is easy
EDIT: I also did a github issue about this "Arduino mega having pins not assigned to be usable on IDE #2307"
I believe that this is something that should be addressed.
This is the Mega board : http://arduino.cc/en/Main/arduinoBoardMega
And that is what the Arduino IDE is for.
I think that when it was designed, it was ment as a super-size Arduino Uno. Perhaps they would have done it differently when they designed it today. Those 16 extra pins can be very useful.
However, the board with the Mega2560 stays as it is. New development is not for more pins, but for faster microcontrollers, and more InternetOfThings, and I think that is a good choice of the Arduino team.
You can use the Arduino libraries, or adapt them or make your own.
Can you copy a link to #2307 in your post ? I can't find it.
If you think that's a problem the Due fails to bring out all the address bus and
data bus pins to headers - only 3 pins are omitted, but it makes the board
impossible to interface to parallel memory chips AFAICT.
it still remains that arduino has pins that are not usable from the IDE without bare C manipulation.
Those pins aren't connected to anything. Not even a nearby via or pad that where could solder a wire. So using them is pretty much beyond the scope of an "Arduino MEGA."