Author Topic: ChipKIT-BB-32 - DIY Chipkit on a Breadboard  (Read 10628 times)

0 Members and 1 Guest are viewing this topic.

Offline caroperTopic starter

  • Regular Contributor
  • *
  • Posts: 193
  • Country: za
    • Take your PIC
ChipKIT-BB-32 - DIY Chipkit on a Breadboard
« on: June 15, 2013, 11:06:19 pm »


In previous threads on this Forum I have attempted to introduce the Microchip MIPS based PIC32MX microcontrollers to potentially interested hobbyists.  The SPDIP  PIC32MX150f128B and PIC32MX250f128B packages make this family accessible for use on a Breadboard.  However, the main drawback was the need to use a PICKit 3 or better Programmer and MPLAB IDE to work with the devices.


It soon became apparent that the complexity of the IDE, particularly MPLAB X, the cryptic documentation for the PLIB peripheral libraries, and the highly crippled free versions of the C compiler, not to mention the need for an expensive programmer, was getting in the way of learning to use and to teach the devices.
One of the most frequent questions I got as a result of my earlier tutorials was the possibility of using a bootloader rather than a dedicated programmer, somthing that I and many others have been looking into for a while now, and products are starting to appear with bootloaders in the CHIPKit and Fubarino family.

The cherry on the top is that Microchip themselves have stepped up to the plate and now offer the PIC32MX250f128B preloaded with a USB Bootloader for use with the MPIDE (Arduino compatible IDE).

Now that Microchip have announced that MPLAB 8 will be dropped in favour of MPLAB X, the timing could not be better, as MPLAB X will scare off more potential users than I care to imagine, even seasoned PIC developers are up in arms about it.
So it is time to cut the umbilical cord.

With that in mind I present the prototype of my Chipkit-BB-32, a fully Chipkit / Arduino compliant development environment on a Standard solderless breadboard, it is not a lot different to the earlier breadboard design, but has been redone to accommodate USB and the Buttons / LED’s needed to operate the bootloader.

It is a great tool for beginners and seasoned PIC users alike and will form the basis, along with Open Source GCC (totally uncrippled as opposed to the Microchip version) C++ compiler and Arduino Compatible libraries.  It will not be confined to simple Arduino sketches either. I intend to delve into the Features of the PIC32 that are over and above those of the Arduino platform.

What I present here is the prototype, it is fully functional and tested with a variety of Standard Arduino Sketches, as well as some PIC32 specific code, and it works well. But I may make a few changes to the board and the Bootloader as I progress. (The main issue at the moment is that the RTCC Pins are used for INT0 and SPI - I need to try and relocate them, I would hate to waste the RTC module).


Cheers
Chris
« Last Edit: June 18, 2013, 11:09:44 am by caroper »
 

Offline caroperTopic starter

  • Regular Contributor
  • *
  • Posts: 193
  • Country: za
    • Take your PIC
ChipKIT-BB-32 - DIY - Part 2
« Reply #1 on: June 17, 2013, 12:41:52 pm »
As promised, here is the Breadboard Layout.

Advanced users should have enough info in the image below to go ahead and build it. For the sake of beginners,  the next few posts will take a step by step approach to constructing and testing the Board, including getting the Bootloader installed for the first time if you are starting with a blank chip.



The circuit uses the Right Hand side of a Standard Solderless Breadboard and is designed for the smallest possible footprint. This means that slightly more than half of the breadboard, on the Left Hand side is available for conducting experiments and constructing interface modules.

The Voltage Regulator is a LM1117-33, the Pin marked Adj is actually the Ground Pin

The Electrolytic Capacitor is a 10uF, it is shown reversed in the drawing, Positive  goes to the center Pin.
The 10uF capacitor on the PIC32MX is a Low ESR  tantalum capacitor.
The 2 Capacitors on the Crystal are 22pF ceramics, but any close value should do, it may even oscillate without them on a breadboard :)
all other Capacitors are 100nF (0.1uF) ceramics.

All Resistors are 1K with the exception of the one on the LDR which is 22K. (it forms a voltage devider so choose one that best matches your LDR Characteristics).

Features:

May be powered via USB or the ICSP Header.

USB Power is regulated down to 3.3 Volts for the benefit of the PIC32MX Device, however a 5V rail is provided as the last row on the Right, to facilitate interfacing to 5V devices such as LCD Displays.


The layout is orientated so that the 5V Tolerant PINS are located near to the 5V rail.

The majority of the ChipKIT PINS are located to the Left of the device and are readily accessible by the empty portion of the Breadboard. This block of PINS includes the Analog Pins.

An ICSP Header is included and serves several roles. It may be used to Install or Replace the Bootloader, Program the board with MPLAB or to connect a PICKit Serial Analyzer / Logic Analyser or UART Tool to assist in Experiments and Debugging.

The LED's are connected to CHIPKit PINS 13 and 14, so that the Standard Arduino Blink Sketch and others should compile and run without modification.

The Prog Button is available for use in Sketches (User Programs) as CHIPKit PIN 17 or RB4.

ChipKIT PIN Numbers are indicated on the Device and Repeated on the Breadboard.  Users may find it useful to print out the above Image as a reference whilst using the board.

The Key is as follows:

The Numerals correspond to ChipKIT / Arduino PIN Numbers i.e. digitalRead(17) would read pin 9 (RB4) of the PIC32MX package, analogRead(A0) would read pin 24 (RB13).
  • Numbers in RED are 5V tolerant Pins.
  • Numbers in GREEN are Analog and Digital PINS and will work with digitalRead() or analogRead() functions.
  • Analog Channel numbers are shown on the Breadboard Overlay along with the corresponding Digital PIN numbers.
  • Numbers with a ~ symbol may be connected to the OC Registers and  used as  Hardware PWM PINS.

Have fun,

Up Next, software...


Cheers
Chris

« Last Edit: June 17, 2013, 07:41:10 pm by caroper »
 

Offline caroperTopic starter

  • Regular Contributor
  • *
  • Posts: 193
  • Country: za
    • Take your PIC
Re: ChipKIT-BB-32 - DIY Chipkit on a Breadboard
« Reply #2 on: June 17, 2013, 07:00:57 pm »
A brief set of instructions to use the board.

Download the MPIDE that fits your OS from one of the following:

Windows: http://chipkit.s3.amazonaws.com/builds/mpide-0023-windows-20130609-test.zip

MACOS X: http://chipkit.s3.amazonaws.com/builds/mpide-0023-macosx-20130609-test.dmg

Linux32:  http://chipkit.s3.amazonaws.com/builds/mpide-0023-linux-20130609-test.tgz



Unzip it to a folder, no need to install it.

Plug the BB-32 Board into the USB.

The LED next to the USB connector indicates 5V present.
The LED next to the ICSP Connector indicates 3V3 present.

If your OS requests a device driver it can be found in the folders you unzipped earlier;

C:\....\mpide-0023-windows-20130609-test\drivers\chipKIT Drivers

It should appear as an stk500v2 device.


If you do not have a preloaded Bootloader use the one attached to this post.

You will need a PICKit 3 or ICD3 to load it.
You can power the board via the PICKit through the ICSP connector. disconnect the USB header first if you do.


Reconnect the USB and the Board should enumerate as a USB device, see above for drivers.

From the folder you unzipped to run mpide.exe


select the Board:
Tools->Board->ChipKIT-> ChipKIT DP32
then
Tools->Serial Port and select the Port that was created by the stk500 driver


When in Bootloader Mode LED2 (RED) will flash at ~ 4Hz

To test the Hardware run this Sketch (also attached):

Code: [Select]

//_________________________________________________________________
//
//  BB32_Test.pde
//
//  C.A.Roper - 2013/07/17
//
//  Hardware confidance test Software for the CHIPKit-BB-32
//  CHIPKit compatable Breadboard circuit based on PIC32MX250F128B.
//
//  Tests Digital Output to LED's
//  Teats Digital Input from Prog Button
//  Tests Analog Input from LDR
//  Tests Serial Output Via USB
//  Tests Serial Input from USB
//_________________________________________________________________
//
int Last;
int State;
int Character;


void setup()
{
  Serial.begin(19200);
  pinMode(17, INPUT);
  pinMode(13, OUTPUT);
  pinMode(14, OUTPUT);
}


void loop()
{
  if(Serial.available())
  {
     Character = Serial.read();
     if(Character == '1') State = 1;
     else if(Character == '0') State = 0;
     else if(Character == 't' || Character == 'T') State = !State;
  }
 
  if(digitalRead(17))
  {
    State = !State;
  }
 
  if(State != Last)
  {
    digitalWrite(13, !State);
    digitalWrite(14, State);
    Serial.println(analogRead(A0));
  }
  Last = State;
  delay(250);
}

Whilst uploading LED1 (Green) will flicker.

Press the Prog Button to toggle the LED's and open the Serial console to see the ADC Reading and to issue commands.


To return to Bootloader mode and upload other Sketches:


Close the Serial Monitor if open.
Press and hold the Prog Button.
Press and release the Reset Button.
Release the Prog Button.


The Green LED will go out and the RED LED will Flash.


That should get the more advanced users up to speed. Detailed instructions to follow for beginners.

Cheers
Chris
« Last Edit: June 17, 2013, 08:23:34 pm by caroper »
 

Offline caroperTopic starter

  • Regular Contributor
  • *
  • Posts: 193
  • Country: za
    • Take your PIC
Re: ChipKIT-BB-32 - DIY Chipkit on a Breadboard
« Reply #3 on: June 18, 2013, 11:03:49 pm »
Due to the difficulties presented by the forum software in working with formatted text, I have decided to move this thread and future Tutorials based on the ChipKit BB32 into its own blog.


If you are interested in the PIC32 and experimenting with the platform please join me there.


I am new to blogging, so any advice, hints, tips and feedback (negative or positive in line with Daves T-Shirt) would be appreciated.


Whilst it is now a ChipKIT board in its own right, runs with the MPIDE and is capable of running Arduino Sketches, I consider there are more than enough Arduino Tutorials out there. This blog will concentrate on the particular capabilities of the PIC32MX family and not the Arduino environment. MPIDE is just a good way to avoid MPLABX and gain access to a Full version of the GCC compiler.



The Blog is using the ChipKit-BB-32 as its intro and will be followed by a mix of Tutorials and Experiments based on the PIC32MX using this board as a development platform. The Projects should work just as well on any other ChipKIT or PIC32MX development board, so building this is a fun and inexpensive way to get started with ChipKit, but it is not a requirement to partake in the discussions.


Please join me at [size=78%]http://caroper.blogspot.com/[/size]


Cheers
Chris


Offline Circuitous

  • Supporter
  • ****
  • Posts: 237
  • Country: us
    • Corgi-Tronics
Re: ChipKIT-BB-32 - DIY Chipkit on a Breadboard
« Reply #4 on: June 18, 2013, 11:43:49 pm »
Chris, nice work.
I checked out your page on Blogspot, I think it is clear and well written.
I've been learning my way through the PIC hierarchy of chips, just starting now with the 24F series.  I may go ahead and jump to the 32F, my current project needs to be field upgraded via a USB stick.  I realize that using the USB port in host mode for bootloading is complicated, but that's the need.  http://corgitronics.com/2013/04/13/nav-beacon-breadboarded/

As for the MPLAB X IDE, I like it and find it intuitive, but I use eclipse a lot for Java and this isn't that much different.  My main gripe is getting the various config flags set for the clock, watchdog, etc... they all seem to change for every chip.

Good luck with your efforts, I'll stay tuned for updates.  Might even send a few questions your way when I get stuck.


Offline caroperTopic starter

  • Regular Contributor
  • *
  • Posts: 193
  • Country: za
    • Take your PIC
Re: ChipKIT-BB-32 - DIY Chipkit on a Breadboard
« Reply #5 on: June 19, 2013, 07:15:50 am »
Hi Circuitous,


Thanks for your comment.


I don't think you would have any problems moving to the PIC32 if you have experience with the PIC18 and PIC24, as they have the same peripheral sets. My mistake was probably Jumping into the PIC32 directly from the PIC16, even trying to get a simple serial port working was a nightmare.

But now I love the PIC32 Family and have used the experience to belatedly look back at the PIC18, PIC24 and dsPIC lines for other projects.

My problem with MPLABX is having to learn yet another IDE, and a complex one at that, I have given it 5 attempts over the past 2 years, whenever I have a gap between projects, and it still has not clicked for me. I use at least 5 other IDE's and MPLABX is the least intuitive.

It took me 2 Hours of searching and trying just to load a pre built hex onto a blank PIC. A task that PICKit2 can do in 2 steps and a command line interface. MPLABX requires a bloated and complex package, creating a project, choosing settings form a half a dozen menus and setting options buried 4 levels deep. :(

I like to use my time developing, not trying to second guess the other developers.

I keep telling myself to persevere and the rewards will follow, but when MPIDE is so easy, has a nice library, a good compiler, allows an external editor (I Use Notepad++), I can be productive immediately.

I think you will find the config flags for the PIC32 are reasonably consistent with PIC24, you probably already know this, but I found it late in my PIC development, Help Menu contains a configuration Option, which intelligently adjusts to the PIC family you selected as the current project. It have save me a lot of time in the past.

Cheers
Chris

Offline lichao

  • Newbie
  • Posts: 7
  • Country: us
Re: ChipKIT-BB-32 - DIY Chipkit on a Breadboard
« Reply #6 on: December 29, 2015, 03:06:45 am »
In another webpage, http://chipkit.net/diy-chipkit-board/, 36pF capacitors were used. Which one is more proper in this scenario?
 

Offline lichao

  • Newbie
  • Posts: 7
  • Country: us
Re: ChipKIT-BB-32 - DIY Chipkit on a Breadboard
« Reply #7 on: December 29, 2015, 03:23:25 am »
In the scheme of raspberry pi, 22pF capacitors were used. So I guess the 22nF in the diagram is a typo
 

Offline BloodyCactus

  • Frequent Contributor
  • **
  • Posts: 482
  • Country: us
    • Kråketær
Re: ChipKIT-BB-32 - DIY Chipkit on a Breadboard
« Reply #8 on: December 29, 2015, 01:32:10 pm »
In the scheme of raspberry pi, 22pF capacitors were used. So I guess the 22nF in the diagram is a typo

the crystal datasheet will tell you what you need. with my pic32mx's the crystal I use says 18pf so I run two 36pf

https://blog.adafruit.com/2012/01/24/choosing-the-right-crystal-and-caps-for-your-design/

-- Aussie living in the USA --
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: ChipKIT-BB-32 - DIY Chipkit on a Breadboard
« Reply #9 on: December 29, 2015, 03:22:51 pm »
Quote
Which one is more proper in this scenario?

It is specific to the crystal used.

Quote
In the scheme of raspberry pi, 22pF capacitors were used. So I guess the 22nF in the diagram is a typo

Likely - 22nf load capacitors would be ***extremely*** unusual.
================================
https://dannyelectronics.wordpress.com/
 

Offline eugenenine

  • Frequent Contributor
  • **
  • Posts: 865
  • Country: us
Re: ChipKIT-BB-32 - DIY Chipkit on a Breadboard
« Reply #10 on: December 29, 2015, 07:11:12 pm »
I've been away from PIC for a while so I never used MPLAB8 but looking at images of it I don't see much difference between it and MPLABX.

What is the LDR for, just an example input?

How do you order the one with the bootloader, is it from microchip direct or do they just have a different part number that can be ordered from mouser/digikey, etc
« Last Edit: December 31, 2015, 03:30:31 am by eugenenine »
 

Offline caroperTopic starter

  • Regular Contributor
  • *
  • Posts: 193
  • Country: za
    • Take your PIC
Re: ChipKIT-BB-32 - DIY Chipkit on a Breadboard
« Reply #11 on: December 30, 2015, 05:45:02 am »
The 22nf in the image should be 22pf, that is the value recommended by microchip.
Some trial and error may be needed, however, as the breadboard itself has a lot of parasitic capacitance.
I found that I could leave the capacitors out entirely and it would still oscillate on more than one breadboard.
The bottom line is that the value is not critical as long as the crystal oscillates and the PIC32 responds.

Cheers
Chris

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: ChipKIT-BB-32 - DIY Chipkit on a Breadboard
« Reply #12 on: December 30, 2015, 11:53:14 am »
Quote
I found that I could leave the capacitors out entirely and it would still oscillate on more than one breadboard.

Yes, because of the straight capacitance on the pins and the board, and the fact that the pullability of a crystal is very small.
================================
https://dannyelectronics.wordpress.com/
 

Offline lichao

  • Newbie
  • Posts: 7
  • Country: us
Re: ChipKIT-BB-32 - DIY Chipkit on a Breadboard
« Reply #13 on: December 30, 2015, 11:59:21 pm »
The 22nf in the image should be 22pf, that is the value recommended by microchip.
Some trial and error may be needed, however, as the breadboard itself has a lot of parasitic capacitance.
I found that I could leave the capacitors out entirely and it would still oscillate on more than one breadboard.
The bottom line is that the value is not critical as long as the crystal oscillates and the PIC32 responds.

Cheers
Chris

Thanks! Btw, for the 10uF one, is it required to use a low-esr capacitor, Or any aluminum electrolytic ones will work? Thanks in advance!
 

Offline caroperTopic starter

  • Regular Contributor
  • *
  • Posts: 193
  • Country: za
    • Take your PIC
Re: ChipKIT-BB-32 - DIY Chipkit on a Breadboard
« Reply #14 on: December 31, 2015, 07:47:30 am »
Thanks! Btw, for the 10uF one, is it required to use a low-esr capacitor, Or any aluminum electrolytic ones will work? Thanks in advance!

It should be a 10uf 6V3 tantalum but a Ceramic would work well too.
You can also get good results by Soldering a SMD Cap directly to the pins, the Micromite users prefer that method and use 47uF capacitor.
In a push it will work with an Electrolytic, but it is not reliable or recommended, I have done it in the past just to test that the build works whilst waiting for the Tantalum's to arrive.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf