Pic32 based board like UNO32?

Was thinking of playing with a design for a new board that is looking foreword… Was thinking of using a PIC32 running at 80mhz. These processors are full 32 bit MIPS based architecture that can do things like 32 bit math in 1 clock so they run pretty quick! I have an UNO32 (digilentinc.com/Products/Det … PKIT-UNO32)which I have been experimenting with and have the phoenix code running on it. There is an Arduino derived IDE for it as well as normal pic support…

I was thinking of starting with the same chip as the UNO32 ( 2 USARTS), although some of the others, like the one used in MAX32 have more support. The question I have is how to fit all of the stuff on a BB2 sized board. There are a couple of options.

a) Do like Botboarduino - and only have the 3 pin connectors, in areas that the normal Arduino shield headers are not…
b) Punt the shield headers - Not sure how many people use these type shields when you have all of the goodies on the board.
c) Cheat: Maybe increase the size of the board form the 3.0"-2.3" size to maybe something like 3.0"-2.8" , where you have 3 pin headers on the outsize of the shield headers. Could have rounded edges that indent toward the corners to fit around standoffs…

Suggestions? Interested? Thought this might be a fun project to work on while you are all gone for Christmas.

Kurt

Forgot to mention: These same ideas and options are also something I wonder about doing a Botboarduino Mega board.

Kurt

Confirmation required… Does this blow the Arduino Mega out of the water? I would recommend ditching the shield format altogether and go for something that makes more sense. Go for a double board design but align the connectors in a more efficient way. Like a row and column on one end of the board or on both ends. But doing it this way should make connecting them together much easier. You could think outside the box and make the two boards fit back to back so they fit very close together. They would need to be soldered together, but they could be manufactured that way. This sounds very powerful and very interesting, but I will not be able to make both Botboarduino Mega and BotboardUno at the same time. The Uno costs $4.33 so it’s not too bad.

Hi Jim,

I am not sure of your question. If you are asking, am I no longer interested in the arduino Mega the answer is mixed. i think it is a very nice board, that is Arduino compatible for those who are really interested. Lots of support, lots of libraries… The UNO32/Max32 are more what I would call risky. That is their is a community of people who have built an Arduino compatible IDE (MPIDE) that allows you to build for Arduinos or for the Max32s. Their current beta version is pretty much up to the level of build 0023 of normal Arduino. They are now still working to get the the now released Arduino 1.0 compatiblity. There are fewer libraries working with this code base. People are working on porting them. I have ported the PS2 library over to work on it. Just a few things I had to do to make it work.
I have been playing around with the SoftwareSerial library from 1.0 and think I know what I need to do to make it work… I just need to now take the time and do it. Been busy trying to get the TA going as well as would love the A-Pod to go…

Now if you are asking performance. My Gut tells me that it should rock. Some comparisons.
Arduino: Atmega328 8 bit at 16mhz. 32K ROM, 2K Ram, 6 AtoD, 1 USART, SPI, I2C
Arduino Mega: Atmega2560 at 16mhz. 256K rom, 8kRam 16 AtoD, 4 USART, SPI, I2C

Uno32: PIC32M320F128F - 32 bit at 80mhz, 128K ROM, 16K RAM, 2 USART, 16 AtoD, 2 SPI, 2 I2C

Max32: Pic32MX795F512 - 32 bit at 80mhz, 512K Rom, 128k Ram, 6 USART, 16 Atod, 3 SPI, 4 I2C plus some USB and Ethernet support…

More descriptions of the different versions in the document: ww1.microchip.com/downloads/en/D … 39904L.pdf

So yes I think this one you could definitively kick some serious … with these. Cost. Probably a bit more, the one in UNO32 for 1 maybe $7 probably down to near $4 in quantity. The one in Max32, maybe $12 down to near $8…

But I do think this would be fun. Will try to think outside the box. Alternative would be surface mount on both sides with potentially multiple signal layers. Have not done this so may be a total pain. The method you mention may still work for Frying pan soldering…

Kurt

Very interesting boards indeed. So you did also port the Phoenix code to the Uno32? Thats great! Did you do any measurements or get any impression of how fast it was?

The MAX32 sure got some great specs too, 6 USART’s, wow.

Could this be an alternative to the propeller board, maybe?

It is one of my Background projects to come up with a board design based on one of these chips. I personally lean toward one with more USARTS like their Max32 as you can never have too many :laughing: It is nice that the code base, for the Pic32s will be almost identical to the Arduinos… When done will be the same, with a few #ifdefs for the differences. There are always some gotchas, like data size differences and what IO pins can do what, and what timers… But the code went over pretty easy. I have not done any speed tests with this yet, but I suspect it should be fine. So far I got it up and running and then jumped back to other projects like, trying to figure out why Xans T-Hex was not walking and trying to jump-start A-pod…

Probably boring can ignore: Over the weekend I was playing some more with the SoftwareSerial library for the Uno32. First I had to do some time tests to figure out how many times I had to spin in a loop for specific delays. The function is simply a tight loop that decrements the counter to zero and then returns. On a standard Arduino at 38400 you loop maybe 54 times on the UNO32 you loop 517 times… So I came up with loop counters for a few of the baud rates that I use (1200, 2400, 9600, 38400, 115200, 125000) and since it is fast enough also added some code to guess on the fly. On the Arduino (unlike BAPs) you also get background Serial inputs on the SoftwareSerial. It does this by using the Pin Change Interrupt and then once it gets the start bit it clocks in the input. So yesterday I got that working pretty well on Uno32 and have done a little testing of it… One trade off that the Arduino people did with their Software Serial was to disable interrupts during a byte input or output. This is great for this output, but can cause other interrupts to be starved and potentially missed, which will probably be an issue (Could go into more details, but…). So if we go very far down this route, I may try changing this library, to be more like my TASerial on BAP and spin waiting for clock time and allow interrupts to happen… May try that on this one soon…

Now to port the XBee code over and try that out… Then will be able to see more how well it works. Probably should order myself a Max32 board from Amazon.com to try out the other USARTS…

As for Propeller, it is an interesting beast, been a long time since I did anything there… Hopefully will have a working board to try it out again. But it takes me awhile to get back into the swing of programming it as it is a completely different beast. Things like if you do math in 32 bits you have signed and unsigned variables, but smaller variables like 8 bit and 16 bit are all unsigned. You have operators that specifically can sign extend the smaller ones, but you have to do this every time… Took awhile to get the math to work at all…

Now back to playing
Kurt

In the green area, are you comparing Arduino Mega to the UNO32? Or in other words, do the Arduino and Arduino Mega run code at the same speed and the only difference is the peripherals? The UNO32 running code at 10 times the speed of Arduino is major! Why aren’t you more excited? lol :slight_smile:

Thanks Jim,

Yep the Arduino and Arduino Mega both run at the same speed 16mhz. The major differences is Ram/Rom, and peripherals. The Uno32/Max32 run at 80mhz, so already we have a 5 to 1 difference, plus it is 32 bit, with most instructions taking 1 clock. My comparison is with two different loops. The Arduino code uses inline assembly language. My one on the Uno32 uses C. I had to add some extra dummy assignment inside the loop in order for the compiler not to completely optimize the loop away… So the counts are somewhat apples to oranges.

So yes, I really do think this could really Rock! :smiley: :smiley:

Kurt

I’m thinking even though it’s risky, I can’t get excited about the Arduino Mega with this power house controller. I can still do the Shield for the Mega, but this UNO32 sounds much more appealing. :smiley: I can’t think of anything else. lol

Wow, that was a big and very interesting difference. You certainly got me excited! :laughing:
Sounds like a BotBoardUno/Max would really kick a… and give TA a big leap!

I assume that a board like that wouldn’t have any problem controlling the new M-series Dynamixel servos either (up to 3Mbps). Took a short look at the documentation from microchip (page 115): “Baud rates ranging from 76 bps to 20 Mbps at 80 MHz”!

PIC32MX440F512H-80I/PT-ND $5.76 in hundreds. They don’t show 1000 quantity price, but it’s probably under $5.00! This is pretty cheap.

Wondering what the current draw is on this chip, and if there are ways to clock down when a lot of processing is not required?

I think this is going to be a very good thing. :slight_smile:

It says you can debug without effecting the running code. :open_mouth:

I didn’t even know this sort of thing existed.

Yep, this could be fun! Now I just need to continue to learn some more to figure out a design. The chip you mentioned looks like it traded off not having I2S??? (something with SPI) and instead had DMA channels. Might be nice to go to a 5 or 7 series and get the extra USARTS. Also then need to decide between 64 pin or 100 pin chips. Not sure yet if most of the 64 pin chip versions are interchangeable or not… Lots more to learn.

Currently I am renting a book "Programming 32-bit Microcontrollers in C, Exploring the PIC32. I found it up at Amazon.com and it is a $60+ book (even for Kindle), but found you can rent it for a month for something like $15. So far it has helped me figure out some stuff about interrupts and some of their IO structures…

Yes having debugging support built-in to a chip is nice. Not sure if you need their ICE to do this, my guess is yes. Also since I am doing most of this with their version of the Arduino IDE, and not the Microchip IDE, I have not played around yet with their simulators and the like, but they can also be helpful to test program parts out without ever even having to download to a board.

Kurt

I got the part number from the data sheet. Please tell which would be better. I think we should stick with the 64 pin version as it’s ample IO for robotics and we are trying to stuff so much on a tiny footprint. I would like to see the price of the preferred chip.

Again I am just learning, but maybe something like: PIC32MX575F512HT-80I/PT-ND. Price is a little higher. Digikey for 1200 has a price of: $6.23. This has 6 usarts, 512K of rom, 64K of Ram, It is the 64 pin TQFP, with 53 total IO…

Kurt

Hope you all have a great holiday season!

During this time, I will play around with some type of a design that is a cross between the BB2 type design and an Arduino type design. The layout may be something similar to what I have shown in the BB64 thread, with maybe 20 IOs on the top and bottom. Probably have all 16 Analogs on one side, plus 4 digital and 20 digital on the other side. Should have some area set up for PS2, with PUs. Also at least some of the USARTS could have their own 3/4 pin connectors… Nice to have speaker. Also should have LED on D13 for standard Arduino type stuff. Probably add 1-2 others (UNO32 has second on 43). Question is, how important are buttons? Expansion, if we don’t worry about shields, we could add a second set of signal pins, just inside the other signal pins. For other IO pins could add additional ones as well. We could choose to populate these pads or not, could have second board that could attach that could be Arduino shield conversion…

Other things wanted on board.
Hardware Programmer connections.
Provisions for RTC
These chips can do other things like be a USB controller, so question will be if we should make provisions. The chip used in MAX32 also has lots of support for network…

That is all for now
Kurt

The PIC32 is a great chip, and mucho better than the AVR in almost every respect. Faster clock, 32-bit instructions, better peripherals. And it is certainly a world of improvement over the awful 8-bit PIC architecture. The only problem is the 3.3V I/O, but that is the direction the embedded world is going. This chip has been on my radar for a while, but I just haven’t been able to free up the time to do anything with it :frowning:

Theoretical speedup is 5x to 10x AVR speed. Using the typical Arduino programming style (single threaded) you will not get anywhere near that performance improvement, but it will still be significantly faster.

The clock can be divided down under software control to reduce power consumption if desired. Unfortunately that would mean all delay times, pulse widths, etc., would need recalculated so it would complicate the software greatly.

I would go with a chip that has DMA if possible. That opens up a new range of possibilities for setting things up to happen in the background with no latency issues and no impact on the performance of executing code. Things like servo output pulses and serial I/O.

Be sure to include a debug connector on the board if it will fit. That is what will enable the non-intrusive debugging mentioned earlier.

Finally, be sure to account for the large number of I/O that are totally intolerant of 5V. Even with a limiting resistor. Basically all of the analog-capable pins will need protection circuitry. Digilent used a combination of resistor and diode on each pin, which is effective. It’s a shame Microchip couldn’t come up with a more robust design for the analog pins.

Mike

Hi Kurt,

I have so many ideas… C’mon words don’t fail me now… I am not really interested in retaining the Arduino shield format as it is really odd. I personally think the “concept” of shields is way cooler than the shields themselves. Besides wifi, xbee, and bluetooth, I don’t really see many shields that are in demand. Of these shields only 2 connections are even used. So the shields are big, bulky, and heavy. They feed all the signals through even though only a couple are used. It just seems easier to put a separate board for these purposes somewhere else on the robot. The can be very small, and can easily connect with a few wires.

The only way to use .04" square .1" spaced header connectors are with through hole as far as I know. So even a kick butt 4 layer board wouldn’t be practical. I know this will require two boards. But I would want whatever the solution to be small and light. The seedunio mega with our shield is really thick and heavy. There are 96 pass through pins. If we only did the 53 IO pins, and 4 ground and 4 power, that’s only 61 pass through pins. It could be a 2 x 16 on one side and 2 x 16 on the other. That would be a lot easier to plug in. The main board would have servo style plugs for servos and general purpose IO, the power terminals, USB connection, speaker, LEDs and push buttons, battery to analog input jumpers, etc. The processor board could fit under or on top of the main board. The pins on the processor board could be smaller than the standard .1" spaced header pins to save space.

That’s all I have for now.

Thanks guys, I appreciate the input and will need lots more by the time we get this done.

Jim, I totally agree with you about shields, Actually the only ones I have found useful is the prototyping shields. I don’t like the XBee ones as they are too rigid on which pins to use. Often using the ones for the USART, which are also used for the USB… I have not tried any of the wifi ones, but these are one case that I do think can be interesting. And building a whole shield for BT seams like using a sledge hammer for… This is why for example I use a separate board for my XBees and not a shield. Obviously if we are using a 64 pin chip which also has multiple Vss and Vdd pins we should not need more than maybe 60 pins for these and maybe VServo and maybe one or two others if it turns out interesting…

To me, if I can I can lay this out such that everything fits on one board and still allow for expansion as I think this would be the best and cheapest option. Not sure if it is doable, but it is a good thing to shoot for.

Mike: My assumption is that for the pins that are not 5V tolerant, I will do the same thing as Digilent did. Not sure yet if I should try to map as many IO pins to the same underlying PIC32 pin that is on the UNO32 or Max32… Need to figure out if they choose the pin ordering as to make it easier to route the board or to have the functionality of the pin be closest to what the pin does on the Arduino or Mega. As for DMA, I need to get better educated on how we might use them on this board. I would appreciate any input you have on choosing the right chip.

Thanks again

Kurt

Kurt,

If you want the board to support the PIC32 variant of the Arduino development environment, then it would be simplest to match their pin mapping and probably their processor choice.

Mike