chipKIT® Development Platform

Inspired by Arduino™

Very New to Arduino. Need Advice on the Max32

Created Tue, 26 Jan 2016 04:22:23 +0000 by JMac8868


Tue, 26 Jan 2016 04:22:23 +0000

I am super new to Arduino. I've never written or assembled anything. Three months ago I got an idea to build a robot to manufacture a part I need for my business and have been having a hard time finding. Three months and many hundreds of hours later I have a very complete robot all constructed out of milled aluminum. The robot has 14 Nema 17 steppers, two mass flow controllers to control propane and o2 for a torch and as of yet no sensors but they will be coming I'm sure. My control center consists of one Chipkit Max32 and fourteen Big Easy drivers. I have already connected the steppers to the BEDs. I am now trying to teach myself how the Max32 works. I am confident that I need three leads on each BED connecting to the Max32. One for step, one for direction and one for ground. Then I need a power supply to each BED.

The issue I am running into is when I read the Max32 reference manual I get completely lost in all of the abbreviations and codes and I can not seem to figure out precisely what they mean. I have a general idea of what to do but I'm lacking confidence in specifics.

At the bottom of the reference manual there is a spreadsheet that lists all of the pins as Pinout by Connector Pin, as an example. On the header of the spreadsheet there is column that says PIC32 Signal and then below in that column I see things like: VREF/CVREF0/AERXD2/PMA7/RA9 and OC5/PMWR/CN13/RD4 and AETXD0/SS1A/U1BRX/U1ACTS/CN20/RD14 and I just don't know what any of this means.

Can anyone tell me where I can find an answer to this question. I want to make sure that the pinouts that I use to control my stepper motors are indeed compatible with that function. I would also like to confirm which pins are compatible with my mass flow controllers. For those what I decided would probably be best is to use PWM and put a low pass filter on each line so that I can use them as analog control for my mass flow controllers. And lastly, which pinouts would be compatible with position sensors should I require them, which I suspect I will. As I begin running the robot over many cycles it will probably get out of sync.

Anyone that can help me I would be very grateful. Even if you could direct me to some sort of in depth manual for this board that explains what all of the abbreviations mean. Thank you!


Tue, 26 Jan 2016 10:42:10 +0000

Hi there, and welcome to the wonderful world of PIC32 [SMILING FACE WITH SMILING EYES]

Unknown acronyms can be a bit daunting, but do not fear, it's not as frightning as it first appears.

Every pin (except just a handful of special ones) can be a generic I/O pin. That is the Rxy acronym, such as RD3 which is pin 3 of port D.

You mention you may use PWM, filtered, to control analog devices. The PWM signal is generated by the Output Compare peripheral in the chip, and that is connected to the OCx pins. You'll notice that the pins marked as PWM on the board all coincide with the OCx pins.

For encoders you probably want to use interrupts. Those pins are the INTx pins.

There are many many other acronyms... PMA12 is address bit 12 of the Parallel Master port, for instance, and Vref+ is the positive voltage reference for the ADC, etc.

Your first port of call should be the datasheet for the pic32mx795f512l chip - the main controller.

That gives you an overview of everything that is in the chip and what most of the pins mean. From there you can go on to the PIC32 Family Reference Manual which is broken down into sections for each of the peripherals. It tells you exactly how each and every register works and how to control that periopheral in its different modes. There is often sample code too. The FRM is in the documentation section of the main pic32 page - just look in the Reference Manual section of the Documentation tab.

I hope this helps get you started on your road to understanding and you have success with your project.

Any other questions or clarification, don't hesitate to ask.

Sent from my SM-T555 using Tapatalk


Tue, 26 Jan 2016 12:01:59 +0000


can you post a description of that robot you have built? Sounds amazing!

Ciao, Mathias


Wed, 27 Jan 2016 02:07:43 +0000

Thank you for your reply. I have been studying the links you provided. I am quite frustrated with myself as I am still finding this very confusing. I have a very peculiar learning process which is quite unlike any other person I have ever met which made traditional school virtually impossible for me. I have a major deficit in one area and an incredibly strong benefit in another. My deficit is that I have a rather shocking inability to absorb information from books, web pages, etc... I can read and read and still feel absolutely confused. I have read and studied for probably ten hours on this issue and still feel as though I am barely grasping anything.

Now as to my strength. That one is quite peculiar. I can literally imagine anything in three dimensions no matter how complex. I can assemble and disassemble even complex machines in my imagination. I somehow see every part and I can rotate them around and do anything with them mentally easily visualizing many details. This "gift" also applies to building things. The robot I constructed over the last couple of months in my spare time is not something I designed. I did not write down one single word or draw a single line on paper or computer. Somehow I can just build things without a design and they always come out perfect. In my mind I am continually molding and remolding whatever I build like it is a sculpture out of clay.

I'm sure this sounds peculiar. Basically I learn information by doing. Not by learning information and then using that information to do what I want or need to do. Generally if someone can just demonstrate what it is I'm trying to learn just one time I will master all of the accompanying information with ease.

I have no robotics experience at all. I have no Arduino experience at all. I have limited metalworking experience but I had this idea for how to build a robot and I just started building it. I collected all of the metal from a local scrap yard and figured out the drive and control system and bought them online.

The robot is 95% complete now and it will produce a part for that is a component of another product I produce and sell. The robot is guaranteed to work. I don't know precisely how it will accomplish the task but I know it will as I have this strange ability to build just about anything and have yet to run into a problem I can not solve.

That was a very long winded way of saying I am an excellent 3d learner and the 2d method for learning strangely leaves me confused beyond comprehension.

So I have a favor I'd like to ask you. Could you provide me with some specific instructions as to precisely what you recommend I do along with a brief explanation as to why I should do it? I can then translate those instructions into action in the 3d environment and I will easily learn this topic of the pinouts and how they function in relation to the Pic32 and the BEDs, oscillators, and mass flow controllers.

If you were building a robot with 14 Nema 17 stepper, driven by 14 BEDs, attached to a Max32 board which specific pinouts would you choose and why would you choose them? With this answer I can make the connections, test them, study the characteristics of those pinouts in the literature and I will understand this quite easily I feel. And if you were building this robot and you had two mass flow controllers to control would you just choose any of the PWM pinouts? Is there a difference in the PWM outputs? Which specific pins would you choose for the PWM if any? And the same question goes for the encoders. You suggest using the INTx pins? Could you tell me why I should use those pins and are any of them more preferable than any others? And if so which specific INTx pins would you use?

I am sorry if this comes off as being demanding or I'm asking for too much but this is how I learn. I do appreciate what you have provided so far and I am reading the information. I am slowly chipping away at this issue. I've read a lot and watched probably thirty videos and I am beginning to grasp a little of this. But, as I said, I learn best by doing. Thanks for you consideration. I appreciate your help greatly.

Oh and I've attached a pic of my robot. The picture doesn't really do it justice. It is really quite cool looking!


Wed, 27 Jan 2016 13:56:53 +0000

That machine is very cool! I love it. Very nice construction. I'd love to see a video of it running (when you have it running!).

I can offer some advice about the driving of the BEDs from your Max32. Which pins you select do not matter at all. That's the good news. If you write your own stepper library, if you use the existing stepper library, or if you choose to download and use the wonderful Accelstepper library (, you can choose any I/O pin for any of the BEDs. Each BED will need two pins (at least) - one for STEP and one for DIRECTION. All pins on the MAX32 can be used as GPIO (general purpose digital input/output), any pins can be used for connecting to the BEDs. You can arbitrarily assign the pins to the BEDs. So do it in whatever way makes the most sense to you - for example, do what makes the most sense for routing wires/connectors in your design, etc.

Let's say you use the AccelStepper library. When you create each of your 13 stepper objects, you will assign each object two pin numbers, one for STEP and one for DIRECTION. Those pin numbers will be the Arduino pin numbers (printed on the MAX32's silk screen) that you have hooked up to that particular BED. For example, if you put your first BED on pins 44 and 46, then you would create your first stepper object in your code like this:

AccelStepper stepper1(AccelStepper::DRIVER, 45, 46);

Then, whenever you tell the stepper1 object to do something (change speed, move, etc.) it will use those digital I/O pin numbers you set in it's constructor.

If you do it this way, you won't need to concern yourself with the actual PIC32 pin number/letters at all - the "Arduino Digital Pin Numbers" is the only thing that will matter, and will be how everything gets referenced in your sketch.



Wed, 27 Jan 2016 14:53:42 +0000

In general all the pins of the same type are exactly the same in their operation and it doesn't matter which you choose. Any of the INTx pins will respond just the same as any other INTx pin. The same with the PWM pins - they all respond just the same in just the same way.

You would use the INTx pins for the encoders simply because they can respond instantly to changes in the logic levels rather than you having to manually poll for changes. For things that happen rapidly interrupts are far more reliable than polling.

The only time when you would choose one over another is if there is something else that one of the pins does that you want to use. It's as simple as that. Just deciding which is the most convenient to use and which allows you to use all the functions you want to use.

Also I'd just like to add a little caveat to Brian's excellent information on the GPIOs there. There's a couple of pins that can't be used as general IO pins - they can be only input and not output or only output and not input. I can't recall off hand exactly which pins they are, but I believe they are somewhere in the big double-row connector at the end of the MAX32 board. The pins themselves are related to the USB peripheral in the main chip - IIRC they are the D+ and D- pins maybe - so just watch out with those it could cause strange problems.

Now as to my strength. That one is quite peculiar. I can literally imagine anything in three dimensions no matter how complex. I can assemble and disassemble even complex machines in my imagination. I somehow see every part and I can rotate them around and do anything with them mentally easily visualizing many details. This "gift" also applies to building things. The robot I constructed over the last couple of months in my spare time is not something I designed. I did not write down one single word or draw a single line on paper or computer. Somehow I can just build things without a design and they always come out perfect. In my mind I am continually molding and remolding whatever I build like it is a sculpture out of clay.

I am very much like that. Not with 3D stuff, but with programs and circuits. I can visualize a whole program and how it will all work together and then just "vomit" it into code (excuse the euphemism there ;) ) with no planning, design, pre-structuring or anything. The same with circuits - I can see the whole circuit and know just how everything in it relates to everything else and how it should work. It's hard to describe it to someone else, it just makes you sound like a nutter ;)

I have no experience with mass flow controllers, so I don't exactly know what they require to control them. Do you have any links to the products you are (or intend) using? There are other options besides filtered PWM for generating an analog voltage level, and many are far more precise than PWM, so they may be a better solution depending on what your controllers need.


Thu, 28 Jan 2016 01:54:53 +0000

Thank you so much. I am VERY grateful to you.

(last minute edit) Upon rereading the replies I see I had two benefactors here. I appreciate the help from both of you. Thanks!

Those replies (both of you) wrote were perfect for my brain. After reading them I sensed they somehow got me out of my head and overthinking the process. I know I have a lot to learn still and I do look forward to that. I intend on building quite a few more robots. The process is so engrossing and fun. Time just flies when I'm in the building process.

I have previously asked for help on blogs and boards with regard to this electronics control system and usually I get a brief explanation that leaves me confused and links to pages that do help but generally take me forever to understand what I'm looking at. Your explanation was exactly what I needed. I feel very confident about moving forward now with connections and programming.

So you have that same sort of organic creation process as well? That is cool! Who knew? Somehow I had it in my head that most everyone in Arduino and related fields were all strictly by the book professorial types. It is interesting how some people just seem to have a natural inclination toward some things with very little experience or training. I was having a conversation with a friend and he brought up the "10,000 hours of study in any field will make anyone a master in that endeavor". He actually insisted that with enough training and focus many people could replicate what Mozart was able to achieve. I found that a bit of a hard pill to swallow to say the least. While I think that sort of training does produce results I have zero doubt that some people just have a gift for certain things regardless of training. Maybe it's DNA code or who knows what it is. I do know that nobody really taught me how to build stuff but I do have a lineage of people who could build stuff. It must be packed in the DNA somewhere I suppose.

I did look into my Mass Flow Controllers. They are older models so I had to request documentation for them which has yet to arrive. I am fairly confident that the preferred and possibly only command signal for these and most MFCs is analogue 0-5v. But I'm not 100% positive as of this moment. I will reply when I know for sure.

Thanks again! I'd like to repay you in some way but I don't know how. You saved me a lot of time and headache. I will share a video of my robot producing parts when it is completed. I'm hoping that will be less than 60 days from now. Fingers crossed.


Thu, 28 Jan 2016 16:26:15 +0000


In addition to the other great advice...

The way I work, I'd do a small test program for each separate device that I need to control/monitor so that I could understand how each device works(what outputs are required and what input data is returned) and then I would start integrating them together. Then the timing interaction/conflict resolution fun would begin!

Also, write a small interrupt driven test program to learn that world too!

You have a very nice project going!