Re: PIC24HJ64GP502 mini-Bully

93 views
Skip to first unread message

Jones, Bryan

unread,
Dec 16, 2014, 6:07:30 PM12/16/14
to pic24-assemb...@googlegroups.com
Bryan,

Thanks for a good description. The PIC does have a bootloader, a program which it uses to reprogram itself. It's possible that this has been corrupted, in which case you need a PICKit 3 (or something similar) to re-program it. However, I'm wondering if the MCLR pin is simply disconnected from the green wire on the USB. Do you press the "reset and program" button to flash your PIC? If so, this wire is needed. An alternative: press the "Program" button, then press the reset button on the PIC within 2 seconds.

Hope that helps!

Bryan

On Sun, Dec 14, 2014 at 9:23 PM, Bryan Bennett <bryan.a...@gmail.com> wrote:
I am using 2 separate PIC24HJ64GP502 mini-Bullies: one on a breadboard circuit where I test new algorithms and the other on a prototype that connects to my wrist to monitor and record heart rate data while I sleep so as to try to detect REM periods (Rapid Eye Movement, when dreams occur). Both PIC24s are using the Bully Bootloader with the MPLAB IDE v8.70 on my laptop. I have not used the prototype PIC24 in about a year. When I previously did use the prototype PIC24, an engineer friend of mine (Cliff, who is much more experienced than myself but presently unavailable) installed the Tera Term logging program on my laptop to log the sleeping heart rate data since he could not determine how to activate the Bully Bootloader logging program (selecting "Logging Enabled" in Bully Bootloader window did not work). In order to use the Tera Term program, Cliff had to open the the SJ3 junction on the mini-Bully circuit board (on the prototype PIC24, not the breadboard PIC24) and thus disconnect its reset pin (MCLR pin #1) from its JP1 RST pin (green wire on USB connection to laptop)

After a year of learning how to write and test new algorithms on my breadboard PIC24, I again returned to my prototype PIC24 to install and use these algorithms while wearing the prototype during sleep. The SJ3 junction on the mini-Bully circuit board was reconnected on the prototype PIC24 since I did not intend to use the Tera Term logging program again but rather only the Bully Bootloader window to view the changing values of my program variables (as I had done on my breadboard PIC24). I had written an algorithm for my I2C accelerometer (MMA8452Q from Spark Fun) that worked perfectly fine on my breadboard PIC24 but failed to work on my prototype PIC24. As I went back and forth between using my two different PIC24s on the Bully Bootloader while trying to get this accelerometer algorithm to work on the prototype PIC24 as it did on the breadboard PIC24, I eventually got to a point where the prototype PIC24 would not even connect to the Bully Bootloader. The Bully Bootloader read: "Exception during serial port read: the operation has timed out. Unable to connect to device, giving up."

After thinking about this for some time, here is my question (and I apologize for my ignorance concerning how these microcontroller devices work; I still have much to learn): when Cliff installed the Tera Term logging program on my laptop, did some Tera Term code also get installed on my prototype PIC24, and could that Tera Term code be interfering with the Bully Bootlaoder code which I also assume is installed on my PIC24? If so, should I try to download new Bully Bootloader code on my prototype PIC24 and thus overwrite the Tera Term code? Any advice that you could offer would be greatly appreciated since I would really like to be able to use my prototype PIC24 again. Unfortunately, Spark Fun no longer sells the PIC24HJ64GP502 mini-Bully.

--
You received this message because you are subscribed to the Google Groups "PIC24 Assembly-to-C Book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pic24-assembly-to-...@googlegroups.com.
To post to this group, send email to pic24-assemb...@googlegroups.com.
Visit this group at http://groups.google.com/group/pic24-assembly-to-c-book.
For more options, visit https://groups.google.com/d/optout.


--
Bryan A. Jones, Ph.D.
Associate Professor
Department of Electrical and Computer Engineering
231 Simrall / PO Box 9571
Mississippi State University
Mississippi state, MS 39762
http://www.ece.msstate.edu/~bjones
bjones AT ece DOT msstate DOT edu
voice 662-325-3149
fax 662-325-2298

Our Master, Jesus Christ, is on his way. He'll show up right on
time, his arrival guaranteed by the Blessed and Undisputed Ruler,
High King, High God.
- 1 Tim. 6:14b-15 (The Message)

Bryan Bennett

unread,
Dec 19, 2014, 8:14:27 PM12/19/14
to pic24-assemb...@googlegroups.com
Hi Bryan,

the SJ3 junction (which connects the MCLR pin to the green wire on the USB) on the mini-Bully of the prototype PIC24H was recently reconnected, and I checked with an ohmmeter to confirm that there was continuity between the MCLR pin and the USB green wire (and there was continuity). 

I do press the "MCLR# and Prgm" button to flash my PIC24 after I have pressed the "Build All" button on my MPLAB IDE v8.70 and its Output window reads "Build Succeeded". 

I tried pressing the Bully Bootloader "Program" button and then pressing the reset button on the mini-Bully PIC24H board within 2 seconds, but the Bully Bootloader still failed to connect to my prototype PIC24H.

My breadboard PIC24H mini-Bully works fine, but it never used the Tera Term logging program like my prototype PIC24H mini-Bully did, and so I am guessing that somehow the Tera Term logging program corrupted the Bully Bootloader code on my prototype PIC24H mini-Bully. 

I returned to the Spark Fun website on the PIC24H mini-Bully which tells me that it comes pre-programmed with the Bully Bootloader firmware and the reset.c application. The users of this board in the "comments" section recommend the PICKit2 for interfacing with it instead of the PICKit3. Do you think it will be possible for me to use the PICKit2 to re-program the Bully Bootloader firmware into my prototype PIC24H mini-Bully with the ICSP interface on the bottom of the mini-Bully board?

One other difference that I have noted between the breadboard PIC24H and the prototype PIC24H:  when I connect the breadboard PIC24H to my laptop via the USB cable, its red LED is brightly illuminated whereas when I connect my prototype PIC24H to my laptop via the USB cable, its red LED is illuminated but very dim (you can barely see the red light emitted from it). To the best of my memory, the prototype red LED was more brightly illuminated when I first started using it again 2 weeks ago and it was still connecting to the Bully Bootloader program on my laptop. I do not know if this is pertinent information.

Whatever advice you could offer would be greatly appreciated.

Bryan Bennett











Jones, Bryan

unread,
Dec 29, 2014, 2:05:00 PM12/29/14
to pic24-assemb...@googlegroups.com
Bryan,

It sounds like the bootloader somehow got corrupted. Yes, you can reprogram it with a PICKit 2 or 3, but you'll also need a special Sparkfun header to adapt the 0.1" PICKit connector to the smaller one on the mini-Bully. I'm not sure why the different in LED brightness, but it doesn't ring a bell.

Bryan

On Fri, Dec 19, 2014 at 7:14 PM, Bryan Bennett <bryan.a...@gmail.com> wrote:
Hi Bryan,

the SJ3 junction (which connects the MCLR pin to the green wire on the USB) on the mini-Bully of the prototype PIC24H was recently reconnected, and I checked with an ohmmeter to confirm that there was continuity between the MCLR pin and the USB green wire (and there was continuity). 

I do press the "MCLR# and Prgm" button to flash my PIC24 after I have pressed the "Build All" button on my MPLAB IDE v8.70 and its Output window reads "Build Succeeded". 

I tried pressing the Bully Bootloader "Program" button and then pressing the reset button on the mini-Bully PIC24H board within 2 seconds, but the Bully Bootloader still failed to connect to my prototype PIC24H.

My breadboard PIC24H mini-Bully works fine, but it never used the Tera Term logging program like my prototype PIC24H mini-Bully did, and so I am guessing that somehow the Tera Term logging program corrupted the Bully Bootloader code on my prototype PIC24H mini-Bully. 

I returned to the Spark Fun website on the PIC24H mini-Bully which tells me that it comes pre-programmed with the Bully Bootloader firmware and the reset.c application. The users of this board in the "comments" section recommend the PICKit2 for interfacing with it instead of the PICKit3. Do you think it will be possible for me to use the PICKit2 to re-program the Bully Bootloader firmware into my prototype PIC24H mini-Bully with the ICSP interface on the bottom of the mini-Bully board?

One other difference that I have noted between the breadboard PIC24H and the prototype PIC24H:  when I connect the breadboard PIC24H to my laptop via the USB cable, its red LED is brightly illuminated whereas when I connect my prototype PIC24H to my laptop via the USB cable, its red LED is illuminated but very dim (you can barely see the red light emitted from it). To the best of my memory, the prototype red LED was more brightly illuminated when I first started using it again 2 weeks ago and it was still connecting to the Bully Bootloader program on my laptop. I do not know if this is pertinent information.

Whatever advice you could offer would be greatly appreciated.

Bryan Bennett











On Tue, Dec 16, 2014 at 6:07 PM, Jones, Bryan <bjo...@ece.msstate.edu> wrote:

Bryan Bennett

unread,
Feb 9, 2015, 9:50:45 PM2/9/15
to pic24-assemb...@googlegroups.com
Bryan,

I ordered a PICKit 3 from Newegg, but it has still not arrived. When it does arrive, I am going to download the bootloader firmware for my PIC24HJ64GP502 into my prototype PIC24H. I just wanted to clarify: the Spark Fun website on the PIC24H mini-Bully has a video tutorial (http://www.ece.msstate.edu/courses/ece3724/main_pic24/videos/mini_bully/index.htm ) that says that the mini-Bully comes pre-programmed with the Bully Bootloader firmware and the reset.c application. Will I need to download both the bootloader firmware (p24HJ64GP502_57600baud_bootldr.hex) and the rest.c application or I can I just download the bootloader firmware only? I am having trouble locating the reset.c application, and it appears to be just a source file for blinking the mini-Bully's LED (which, I am guessing, I do not need). 

Also, when I go to the Spark Fun website for the mini-Bully PIC24HJ64GP502 (https://www.sparkfun.com/products/retired/9148), there is a link near the bottom that says "Firmware" which eventually leads me to a file labeled as "p24HJ64GP502_57600baud_bootldr.hex". Is this the firmware that I want to download with the PICKit 3 into my prototype PIC24H that will hopefully allow my prototype PIC24H to communicate with the Bully Bootloader program on my PC? I have never done this previously, and so I am just trying to minimize my chances of making any stupid mistakes. Any advice that you could offer would be greatly appreciated.

Thanks,

Bryan Bennett

Jones, Bryan

unread,
Feb 11, 2015, 3:40:29 PM2/11/15
to pic24-assemb...@googlegroups.com
Bryan,

You can download only the Bully Bootloader application; using that, you can then load any other program (such as reset). You're correct that reset.c is just a source file -- compile that to produce a .hex then use that with the bootloader.

In terms of which file to download, yes, that will work. These days, the newer libraries use a higher baud rate (230400 baud), so you can also program that version of the bootloader.

Bryan

On Mon, Feb 9, 2015 at 8:50 PM, Bryan Bennett <bryan.a...@gmail.com> wrote:
Bryan,

I ordered a PICKit 3 from Newegg, but it has still not arrived. When it does arrive, I am going to download the bootloader firmware for my PIC24HJ64GP502 into my prototype PIC24H. I just wanted to clarify: the Spark Fun website on the PIC24H mini-Bully has a video tutorial (http://www.ece.msstate.edu/courses/ece3724/main_pic24/videos/mini_bully/index.htm ) that says that the mini-Bully comes pre-programmed with the Bully Bootloader firmware and the reset.c application. Will I need to download both the bootloader firmware (p24HJ64GP502_57600baud_bootldr.hex) and the rest.c application or I can I just download the bootloader firmware only? I am having trouble locating the reset.c application, and it appears to be just a source file for blinking the mini-Bully's LED (which, I am guessing, I do not need). 

Also, when I go to the Spark Fun website for the mini-Bully PIC24HJ64GP502 (https://www.sparkfun.com/products/retired/9148), there is a link near the bottom that says "Firmware" which eventually leads me to a file labeled as "p24HJ64GP502_57600baud_bootldr.hex". Is this the firmware that I want to download with the PICKit 3 into my prototype PIC24H that will hopefully allow my prototype PIC24H to communicate with the Bully Bootloader program on my PC? I have never done this previously, and so I am just trying to minimize my chances of making any stupid mistakes. Any advice that you could offer would be greatly appreciated.

Thanks,

Bryan Bennett

Bryan Bennett

unread,
Feb 16, 2015, 1:00:37 AM2/16/15
to pic24-assemb...@googlegroups.com
Bryan,

my PICkit 3 just recently arrived. It had the PICkit 3 device and the USB cable but no software CD. The video tutorial (http://www.ece.msstate.edu/courses/ece3724/main_pic24/videos/pickit2/index.htm) which shows how to use the PICkit 2 for In-Circuit Serial Programming (ICSP) says that "the PICkit 2 comes with software for accomplishing In-Circuit Serial Programming. If you have the PICkit 2 plugged into your board, then when the PICkit 2 software starts up, it should automatically detect your CPU as shown here." The video shows a screen shot of a window labeled "PICkit 2 Programmer" which is the program for downloading via the ICSP.

Does the PICkit 3 come with the software necessary for ICSP already installed on it, or do I need to download this software from Microchip onto my PC? If such a program is already installed on the PICkit 3, will it appear on my PC screen when I plug the PICkit 3 into my PC USB?

Any advice that you could offer would be greatly appreciated.
Thanks,
Bryan Bennett

Jones, Bryan

unread,
Feb 16, 2015, 12:51:43 PM2/16/15
to pic24-assemb...@googlegroups.com
Bryan,

Use MPLAB X, a free Microchip download. That comes with the MPLAB IPE (integrated programming environment). The app is very different form the Pickit 2, but the ideas are still there. Let me know where you get stuck after that's installed.

On Mon, Feb 16, 2015 at 12:00 AM, Bryan Bennett <bryan.a...@gmail.com> wrote:
Bryan,

my PICkit 3 just recently arrived. It had the PICkit 3 device and the USB cable but no software CD. The video tutorial (http://www.ece.msstate.edu/courses/ece3724/main_pic24/videos/pickit2/index.htm) which shows how to use the PICkit 2 for In-Circuit Serial Programming (ICSP) says that "the PICkit 2 comes with software for accomplishing In-Circuit Serial Programming. If you have the PICkit 2 plugged into your board, then when the PICkit 2 software starts up, it should automatically detect your CPU as shown here." The video shows a screen shot of a window labeled "PICkit 2 Programmer" which is the program for downloading via the ICSP.

Does the PICkit 3 come with the software necessary for ICSP already installed on it, or do I need to download this software from Microchip onto my PC? If such a program is already installed on the PICkit 3, will it appear on my PC screen when I plug the PICkit 3 into my PC USB?
Any advice that you could offer would be greatly appreciated.
Thanks,
Bryan Bennett

Bryan Bennett

unread,
Feb 23, 2015, 12:26:47 AM2/23/15
to pic24-assemb...@googlegroups.com
Bryan,

I actually previously installed MPLAB X IDE v2.15 and IPE v2.15 on another PC of mine (which also has Windows 7) last summer in order to experiment with the Microstick 2 PIC24HJ128GP502 (but I really prefer your Bully Bootloader for testing my application).

I have been reading the Microchip literature on PICkit 3 and the IPE. When I actually do use the IPE with the PICkit 3, will I also need to open the MPLAB X IDE before using the IPE? I am wondering because will I need to import the bootloader firmware (p24HJ64GP503_57600baud_bootldr.hex) through the MPLAB X IDE to the IPE or can I import it directly to the IPE from "Downloads" of my PC Windows 7? 

Your textbook ("Microcontrollers: From Assembly Language to C....") says on page 728 that program memory locations 0x00200 through 0x00C00 are reserved for use by the bootloader firmware. I am assuming that the linker file associated with the IPE will automatically cause the bootloader firmware to be programmed into those program memory addresses (0x00200 to 0x00C00). Is that correct?

Also, since the Sparkfun adapter (BOB-00194) needed to connect the PICkit 2 or 3 to the miniature ICSP on the back of the mini-Bully board is no longer available, I have wired my prototype PIC24HJ64GP502 exactly as shown in Dr. Reese's tutorial video which shows how to connect the PICkit 2 to a PIC24HJ32GP202 microcontroller for ICSP on a breadboard (http://www.ece.msstate.edu/courses/ece3724/main_pic24/videos/pickit2/index.htm). Will that be suitable also for using my PICkit3?

Thanks so much for your time and help,

Bryan Bennett








 

Jones, Bryan

unread,
Feb 23, 2015, 4:53:17 PM2/23/15
to pic24-assemb...@googlegroups.com
Bryan,

No, the IPE is a stand-alone environment that can load .hex files and program them without the IDE. Just import the .hex from from downloads. Using the linker files supplied with the book will produce .hex files which avoid using the reserved section of program memory. A hand-wired adaptor will work fine; it's just wires.

On Sun, Feb 22, 2015 at 11:26 PM, Bryan Bennett <bryan.a...@gmail.com> wrote:
Bryan,

I actually previously installed MPLAB X IDE v2.15 and IPE v2.15 on another PC of mine (which also has Windows 7) last summer in order to experiment with the Microstick 2 PIC24HJ128GP502 (but I really prefer your Bully Bootloader for testing my application).

I have been reading the Microchip literature on PICkit 3 and the IPE. When I actually do use the IPE with the PICkit 3, will I also need to open the MPLAB X IDE before using the IPE? I am wondering because will I need to import the bootloader firmware (p24HJ64GP503_57600baud_bootldr.hex) through the MPLAB X IDE to the IPE or can I import it directly to the IPE from "Downloads" of my PC Windows 7? 

Your textbook ("Microcontrollers: From Assembly Language to C....") says on page 728 that program memory locations 0x00200 through 0x00C00 are reserved for use by the bootloader firmware. I am assuming that the linker file associated with the IPE will automatically cause the bootloader firmware to be programmed into those program memory addresses (0x00200 to 0x00C00). Is that correct?

Also, since the Sparkfun adapter (BOB-00194) needed to connect the PICkit 2 or 3 to the miniature ICSP on the back of the mini-Bully board is no longer available, I have wired my prototype PIC24HJ64GP502 exactly as shown in Dr. Reese's tutorial video which shows how to connect the PICkit 2 to a PIC24HJ32GP202 microcontroller for ICSP on a breadboard (http://www.ece.msstate.edu/courses/ece3724/main_pic24/videos/pickit2/index.htm). Will that be suitable also for using my PICkit3?

Thanks so much for your time and help,

Bryan Bennett








 

Bryan Bennett

unread,
Feb 27, 2015, 10:29:07 PM2/27/15
to pic24-assemb...@googlegroups.com
Bryan,

I cannot get the IPE to communicate properly with the PICkit 3. It reads "connection failed". I think that the proper USB driver for the PICkit 3 is no longer on my laptop. When I installed MPLAB X IDE and IPE on my other Windows 7 laptop, to the best of my memory, I evidently changed the USB drivers on that lap top also. 

Can you possibly explain to me how I can re-install the proper USB driver for the PICkit 3 or perhaps point me to a website that will?

Thanks,

Bryan Bennett








Jones, Bryan

unread,
Mar 2, 2015, 10:25:51 AM3/2/15
to pic24-assemb...@googlegroups.com
Bryan,

How is your miniBully powered? What I usually do is disconnect the miniBully from the USB power, then run it from power supplied by the pickit3 (a checkbox in advanced mode in the IPE). I would suspect that before driver problems.

On Fri, Feb 27, 2015 at 9:29 PM, Bryan Bennett <bryan.a...@gmail.com> wrote:
Bryan,

I cannot get the IPE to communicate properly with the PICkit 3. It reads "connection failed". I think that the proper USB driver for the PICkit 3 is no longer on my laptop. When I installed MPLAB X IDE and IPE on my other Windows 7 laptop, to the best of my memory, I evidently changed the USB drivers on that lap top also. 

Can you possibly explain to me how I can re-install the proper USB driver for the PICkit 3 or perhaps point me to a website that will?

Thanks,

Bryan Bennett








Bryan Bennett

unread,
Mar 2, 2015, 7:23:58 PM3/2/15
to pic24-assemb...@googlegroups.com
Bryan,

my Mini Bully is supposed to be powered by the PICkit 3, but I checked my breadboard to which my prototype PIC24 is presently connected with a voltmeter (after reading your latest email), and it is not getting any voltage from the PICkit 3 (there is no voltage coming from the PICkit 3).

I followed Dr. Reese's video tutorial for using the PICkit 2 for ICSP with a PIC24HJ32GP202 exactly as shown (http://www.ece.msstate.edu/courses/ece3724/main_pic24/videos/pickit2/index.htm), and this video says that the PICkit 2 would power the PIC24 during ICSP.

I have tried the IPE with my PICkit 3 several times in the last 3 days, but when I go to "Settings" > "Advanced Mode" on the IPE and then select "Power" to set the voltage (after using the "microchip" password),  under the "ICSP Options", the "Power Target Circuit from Tool" option is always grayed out and so I cannot select it. 

I have assumed (but I could be wrong, of course) that this is a USB driver problem because a Microchip tutorial (https://microchip.wikidot.com/mplabx:switching-usb-drivers) explains that the MPLAB IDE 8 and the MPLAB X IDE use different USB drivers (MPLAB X IDE uses Micrsoft's generic WinUSB driver while the MPLAB IDE 8 and earlier uses a set of proprietary drivers) and that the PICkit 2 and 3 use the standard Human Interface driver found on all systems. I must have changed those USB drivers on my second laptop (the one on which I installed the MPLAB X IDE v2.15 and IPE v2.15 to experiment with the Microstick II PIC24HJ128GP502), but unfortunately the MPLAB Device Driver Switcher program is not available on this laptop since only the MPLAB X IDE is installed on this laptop and not the MPLAB IDE 8 (which is installed on another laptop where I use your Bully Bootloader program). 

Also, when I examine the Microchip tutorial on switching USB drivers between MPLAB X IDE and MPLAB IDE 8 (https://microchip.wikidot.com/mplabx:switching-usb-drivers) by using the MPLAB Device Driver Switcher program, under the "Tool Group and Action" in the switcher program, there is evidently no way to select PICkit 2 or 3 (the only choices are: REAL ICE, ICD2, ICD3, PM3, and PIC32 SK).

I have consulted individuals more knowledgeable of computers than myself, and they say that effectively switching the USB driver for the PICkit 3 could be very difficult. Consequently, I have ordered the PICkit 2 and intend to install its program (PICkit 2 Programmer) on a third PC (a desktop with Windows 7). Do you think that the PICkit 2 will come with a CD software containing its program? If not, do you know where I could find this program? This is the same program that I see in Dr. Reese's video tutorial that I mentioned above.

At this point, I really do not see what else that I can do, but I am certainly open to any suggestions that you might have.

Thanks for your time and help,

Bryan Bennett












Jones, Bryan

unread,
Mar 13, 2015, 10:32:06 AM3/13/15
to pic24-assemb...@googlegroups.com
Bryan,

Could you send me a screenshot of your IPE on the Power tab? On mine, this box isn't grayed out but works fine. Or, if the PicKit 2 works for you, we can just go with that.

Bryan

On Mon, Mar 2, 2015 at 6:23 PM, Bryan Bennett <bryan.a...@gmail.com> wrote:
Bryan,

my Mini Bully is supposed to be powered by the PICkit 3, but I checked my breadboard to which my prototype PIC24 is presently connected with a voltmeter (after reading your latest email), and it is not getting any voltage from the PICkit 3 (there is no voltage coming from the PICkit 3).

I followed Dr. Reese's video tutorial for using the PICkit 2 for ICSP with a PIC24HJ32GP202 exactly as shown (http://www.ece.msstate.edu/courses/ece3724/main_pic24/videos/pickit2/index.htm), and this video says that the PICkit 2 would power the PIC24 during ICSP.

I have tried the IPE with my PICkit 3 several times in the last 3 days, but when I go to "Settings" > "Advanced Mode" on the IPE and then select "Power" to set the voltage (after using the "microchip" password),  under the "ICSP Options", the "Power Target Circuit from Tool" option is always grayed out and so I cannot select it. 

I have assumed (but I could be wrong, of course) that this is a USB driver problem because a Microchip tutorial (https://microchip.wikidot.com/mplabx:switching-usb-drivers) explains that the MPLAB IDE 8 and the MPLAB X IDE use different USB drivers (MPLAB X IDE uses Micrsoft's generic WinUSB driver while the MPLAB IDE 8 and earlier uses a set of proprietary drivers) and that the PICkit 2 and 3 use the standard Human Interface driver found on all systems. I must have changed those USB drivers on my second laptop (the one on which I installed the MPLAB X IDE v2.15 and IPE v2.15 to experiment with the Microstick II PIC24HJ128GP502), but unfortunately the MPLAB Device Driver Switcher program is not available on this laptop since only the MPLAB X IDE is installed on this laptop and not the MPLAB IDE 8 (which is installed on another laptop where I use your Bully Bootloader program). 

Also, when I examine the Microchip tutorial on switching USB drivers between MPLAB X IDE and MPLAB IDE 8 (https://microchip.wikidot.com/mplabx:switching-usb-drivers) by using the MPLAB Device Driver Switcher program, under the "Tool Group and Action" in the switcher program, there is evidently no way to select PICkit 2 or 3 (the only choices are: REAL ICE, ICD2, ICD3, PM3, and PIC32 SK).

I have consulted individuals more knowledgeable of computers than myself, and they say that effectively switching the USB driver for the PICkit 3 could be very difficult. Consequently, I have ordered the PICkit 2 and intend to install its program (PICkit 2 Programmer) on a third PC (a desktop with Windows 7). Do you think that the PICkit 2 will come with a CD software containing its program? If not, do you know where I could find this program? This is the same program that I see in Dr. Reese's video tutorial that I mentioned above.

At this point, I really do not see what else that I can do, but I am certainly open to any suggestions that you might have.

Thanks for your time and help,

Bryan Bennett












Bryan Bennett

unread,
Mar 29, 2015, 11:08:20 PM3/29/15
to pic24-assemb...@googlegroups.com
Bryan,  

the PICkit 2 does not support PIC24HJ64GP502 (I found out after I bought it), but I was finally able to get the PICkit 3 to work with the IPE when I installed the IPE on my desk top computer and did not switch the USB drivers (as I had done on another lap top where I also installed the MPLB X IDE). 

After connecting the PICkit 3 to my PIC24H prototype and programming it with the bootloader firmware (p24HJ64GP502_57600baud_bootldr.hex) by using the IPE, the IPE output window read:

Programmer to target power is enabled - VDD = 3.250000 volts.
Target device PIC24HJ64GP502 found.
Device ID Revision = 3003
2015-03-29T12:04:00-0400- Loading hex file. Please wait...
Loading code from C:\Users\Owner\Downloads\p24HJ64GP502_57600baud_bootldr.hex...
2015-03-29T12:04:00-0400- Hex file loaded successfully.

2015-03-29T12:04:36-0400- Programming...

The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0xbff
configuration memory

Device Erased...

Programming...
Programming/Verify complete
2015-03-29T12:04:41-0400- Programming complete
Pass Count: 1

Evidently, my PIC24H prototype was successfully downloaded with the Bully bootloader firmware (p24HJ64GP502_57600baud_bootldr.hex). However, when I connect the PIC24H to my laptop with the Bully bootloader GUI, the Bully bootloader GUI window still reads: "Exception during serial port read: the operation has timed out. Unable to connect to device, giving up."  I really thought that the PIC24H bootloader firmware had somehow been corrupted, but now I do not know what to think. Any suggestions that you might have would be greatly appreciated.

Jones, Bryan

unread,
Apr 1, 2015, 2:22:31 PM4/1/15
to pic24-assemb...@googlegroups.com
Bryan,

You're making progress. Did you set the baud rate of the bootloader to 57,600 baud? Did you open the port? Did you click MCLR & reset or press the reset button on your PIC manually and click Program in the GUI within 2 seconds?

On Sun, Mar 29, 2015 at 10:08 PM, Bryan Bennett <bryan.a...@gmail.com> wrote:
Bryan,  

the PICkit 2 does not support PIC24HJ64GP502 (I found out after I bought it), but I was finally able to get the PICkit 3 to work with the IPE when I installed the IPE on my desk top computer and did not switch the USB drivers (as I had done on another lap top where I also installed the MPLB X IDE). 

After connecting the PICkit 3 to my PIC24H prototype and programming it with the bootloader firmware (p24HJ64GP502_57600baud_bootldr.hex) by using the IPE, the IPE output window read:

Programmer to target power is enabled - VDD = 3.250000 volts.
Target device PIC24HJ64GP502 found.
Device ID Revision = 3003
2015-03-29T12:04:00-0400- Loading hex file. Please wait...
Loading code from C:\Users\Owner\Downloads\p24HJ64GP502_57600baud_bootldr.hex...
2015-03-29T12:04:00-0400- Hex file loaded successfully.

2015-03-29T12:04:36-0400- Programming...

The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0xbff
configuration memory

Device Erased...

Programming...
Programming/Verify complete
2015-03-29T12:04:41-0400- Programming complete
Pass Count: 1

Evidently, my PIC24H prototype was successfully downloaded with the Bully bootloader firmware (p24HJ64GP502_57600baud_bootldr.hex). However, when I connect the PIC24H to my laptop with the Bully bootloader GUI, the Bully bootloader GUI window still reads: "Exception during serial port read: the operation has timed out. Unable to connect to device, giving up."  I really thought that the PIC24H bootloader firmware had somehow been corrupted, but now I do not know what to think. Any suggestions that you might have would be greatly appreciated.

Bryan Bennett

unread,
Apr 1, 2015, 10:17:54 PM4/1/15
to pic24-assemb...@googlegroups.com
Bryan,

With my prototype PIC24H connected to the application circuit (while the GUI is opened on my PC, and my prototype PIC24H is connected to my PC USB), then I set the baud rate at 57,600. I have a check in the "OpenCom" box. I clicked the "MCLR# and Prgm" button (I also tried pressing the reset button manually on my PIC and then clicking the "Program" button in the GUI within 2 seconds). 

In the lower GUI window (that displays bootloader status output), when I first open the GUI on my PC and before I click the "MCLR# and Prgm" button, it reads:

Started...
Reading settings from: C:\Users\Bryan Bennett\AppData\Local\BullyBootloader\bootloaderProps.txt

Settings loaded

Loading Device File: C:\Program Files (x86)\Bully Bootloader\devices.txt
Device File loaded

Then, as soon as I click on the "MCLR# and Prgm" button (or press the reset button manually on my PIC and then click the "Program" button in the GUI within 2 seconds), it reads:

Reading Target Device ID
Exception during serial port read: the operation has timed out. Unable to connect to device, giving up.

Also, the text bar next to the "Program" button reads "not Found"

I noticed that the red LED on the mini-Bully board is not illuminated, and so I checked the voltage between GND and 5V on JP1 and confirmed 5 volts. Interestingly enough, when I connect my prototype PIC24H to the PC without also being connected to the application circuit, the red LED is illuminated but with less brightness than the breadboard PIC24H.

When I connect my breadboard PIC24H to the same application circuit, it works fine, and the heart rate and motion detection data are displayed in the GUI.

Bryan Bennett









 

Bryan Bennett

unread,
Jun 3, 2015, 5:21:39 PM6/3/15
to pic24-assemb...@googlegroups.com
Bryan,

I finally decided to use my breadboard PIC24 as my wearable prototype PIC24 since I could never get the original prototype PIC24 to function properly. However, I am really stuck with I2C communications between my PIC24 and my MMA8452Q accelerometer, and I could really use some advice.

I am trying to read one register at a time on my accelerometer, and I am using the following C code:

#define MMA8452Q_ADDR  0x3A  //0b 0011 1010 (accelerometer device I2C address (0x1D) plus 0 LSb for R/W bit)
#define WHO_AM_I 0x0D     // MMA8452Q ID register
write1I2C1(MMA8452Q_ADDR, WHO_AM_I); // read device ID register
read1I2C1(MMA8452Q_ADDR, &Accel_ID);

I am using I2C read and write functions defined in my source file as such:

void write1I2C1(uint8_t u8_addr,uint8_t u8_d1) {
  startI2C1();
  putI2C1(I2C_WADDR(u8_addr));
  putI2C1(u8_d1);
  stopI2C1();
}

void read1I2C1(uint8_t u8_addr,uint8_t* pu8_d1) {
  startI2C1();
  putI2C1(I2C_RADDR(u8_addr));
  *pu8_d1 = getI2C1(I2C_NAK); //last ack bit from master to slave during read must be a NAK
  stopI2C1();
}

When I used these I2C read and write functions to read the WHO_AM_I register of my accelerometer, I got the wrong data (I printed the data to the Bully Bootloader GUI window). I corresponded with the accelerometer manufacturer's engineer who told me that I must insert the repeated start function (rstartI2C1();) in place of the stop function (stopI2C1();) within my write1I2C1 function. I did that in my pic24_i2c.c file, compiled my new code ("build all"), and now my PIC24 does not read the accelerometer's register at all (no data at all is printed to the Bully Bootloader GUI window).

Evidently I am using these I2C functions in the wrong way. Please show me the I2C functions that I need to use in order to read one register of my accelerometer at a time. I have read the I2C section (pages 414 to 432) of your textbook ("Microcontrollers:From Assembly Language to...") more than once, and I cannot figure out what I am doing wrong.

Any advice that you could offer would be greatly appreciated.

Thank you for your time,

Bryan Bennett












Jones, Bryan

unread,
Jun 5, 2015, 5:04:21 PM6/5/15
to pic24-assemb...@googlegroups.com
Bryan,

I don't see anything obviously wrong. How are you calling these functions and printing the resulting data? Perhaps it's a bug there. Also, make sure the address is correct -- for this part, there are two possibilities based on how you configure one of the pins.

On Wed, Jun 3, 2015 at 4:21 PM, Bryan Bennett <bryan.a...@gmail.com> wrote:
Bryan,

I finally decided to use my breadboard PIC24 as my wearable prototype PIC24 since I could never get the original prototype PIC24 to function properly. However, I am really stuck with I2C communications between my PIC24 and my MMA8452Q accelerometer, and I could really use some advice.

I am trying to read one register at a time on my accelerometer, and I am using the following C code:

#define MMA8452Q_ADDR  0x3A  //0b 0011 1010 (accelerometer device I2C address (0x1D) plus 0 LSb for R/W bit)
#define WHO_AM_I 0x0D     // MMA8452Q ID register
write1I2C1(MMA8452Q_ADDR, WHO_AM_I); // read device ID register
read1I2C1(MMA8452Q_ADDR, &Accel_ID);

I am using I2C read and write functions defined in my source file as such:

void write1I2C1(uint8_t u8_addr,uint8_t u8_d1) {
  startI2C1();
  putI2C1(I2C_WADDR(u8_addr));
  putI2C1(u8_d1);
  stopI2C1();
}

void read1I2C1(uint8_t u8_addr,uint8_t* pu8_d1) {
  startI2C1();
  putI2C1(I2C_RADDR(u8_addr));
  *pu8_d1 = getI2C1(I2C_NAK); //last ack bit from master to slave during read must be a NAK
  stopI2C1();
}

When I used these I2C read and write functions to read the WHO_AM_I register of my accelerometer, I got the wrong data (I printed the data to the Bully Bootloader GUI window). I corresponded with the accelerometer manufacturer's engineer who told me that I must insert the repeated start function (rstartI2C1();) in place of the stop function (stopI2C1();) within my write1I2C1 function. I did that in my pic24_i2c.c file, compiled my new code ("build all"), and now my PIC24 does not read the accelerometer's register at all (no data at all is printed to the Bully Bootloader GUI window).

Evidently I am using these I2C functions in the wrong way. Please show me the I2C functions that I need to use in order to read one register of my accelerometer at a time. I have read the I2C section (pages 414 to 432) of your textbook ("Microcontrollers:From Assembly Language to...") more than once, and I cannot figure out what I am doing wrong.
Any advice that you could offer would be greatly appreciated.

Thank you for your time,

Bryan Bennett

Bryan Bennett

unread,
Jun 29, 2015, 5:42:01 PM6/29/15
to pic24-assemb...@googlegroups.com
Bryan,

I finally got the I2C read and write functions to work correctly with the MMA8452Q accelerometer (I had to replace the stop and start functions with a restart function). I am now ready to wear my device and record heart rate and body motion throughout the night. I will be using the Bully Bootloader. When I click on the "Logging Enabled" box at the top of the Bully Bootloader window, where will the data within the window be stored?

Thanks,

Bryan Bennett
Reply all
Reply to author
Forward
0 new messages