chipKIT® Development Platform

Inspired by Arduino™

Pic32 Pin arrangment

Created Wed, 06 Jun 2012 19:10:58 +0000 by nik999389


nik999389

Wed, 06 Jun 2012 19:10:58 +0000

So I just recently got my Uno32 and I'm excited to work on it, I started looking through the datasheet and i noticed the pinouts for the ports are pretty weird. PortA is all over the place, port B is half together and the rest of the ports seem to ollow this order. How are you supposed to set up the pins so that they run correctly when you assign a hex value to the port? It seems to me like the bits will be distributed around the whole processor in no real order. Can someone show me some regular use for the ports; assigning them and the hardware connection because I'm a bit lost.


rasmadrak

Wed, 20 Jun 2012 10:00:55 +0000

Unfortunately, that's the way it is... Have you tried checking the referencemanual for pin locations etc?


nik999389

Wed, 20 Jun 2012 14:27:50 +0000

Yeah I got them to work, it's just a little frustrating no being able to know exactly where which pins are but ill work around it. Thanks!


GeneApperson

Thu, 28 Jun 2012 21:07:42 +0000

The reason that the pins are not brought out to the connectors by port is to provide some degree of compatibility with the Arduino Uno.

The Atmel AVR microcontroller and the PIC32 microcontroller don't share functions between pins in remotely the same way. When the Arduino boards were designed, they brought the pins out to connectors by port. That was easy for them, as they didn't have any existing board they were trying to be compatible with.

The choice was either to bring the PIC32 pins out to the connectors in the same order they are in the ports, or to bring out the same functions (e.g. UART Tx and Rx, or I2C SDA, SCL) to the same connector pins. Bringing them out by function is the only way to get shields and standard libraries to have a chance of working compatibily, so that is what I did.

Engineering is all about trade offs. :)

Gene Apperson Digilent


WestfW

Sat, 30 Jun 2012 08:44:47 +0000

How are you supposed to set up the pins so that they run correctly when you assign a hex value to the port?

You're sort-of supposed to use the Arduino-style APIs that access the pins one-at-a-time, referenced by the board "pin number" rather than the cpu "port."


nik999389

Mon, 02 Jul 2012 14:19:04 +0000

Yeah, I got that but using those calls is too slow. I need optimum performance from the microprocessor and using those calls just wont cut it. But thanks guys! I'm more comfortable with this chip now and am embarking on a couple projects.


WestfW

Tue, 03 Jul 2012 06:36:35 +0000

your best bet for high-speed "wide" access to pins is either RE0..7 (not part of the Arduino-compatible pinout), or the pins that have been nominally designated as "analog"

If you need fast but not particularly wide, there are a couple ways to use the same pin-mapping database as the Arduino calls while getting much better speed. Search for "fast_digital_write"


nik999389

Tue, 03 Jul 2012 15:40:32 +0000

Is there something wrong with actually using the registers? The reason why I ask is because I'm trying to accomplish serial communication with an lcd using 6800 serial mode. It's basically spi with a whole port (8-pins) broken out on the graphics processor. So when I want to send a command or some data i just set my port to a hex number and then mess with the control pins. I think that setting all 8 pins separately would be a real pain >.<


WestfW

Wed, 04 Jul 2012 03:24:51 +0000

There's nothing wrong with using the the full port registers, assuming you've gathered the wiring appropriately. I get a bit nervous when people start talking simultaneously about driving the output pins "as fast as possible" AND stringing wires from every which place to their peripheral. Driving a significant length of wire at 10+MHz is not as trivial as it might seem to the usual programmer! RE0..7 and some of the analog pins are where there happen to be a bunch of bits from the same port, right next to each other.