Help with USB HID BootLoader for PIC24FJ

General discussion on mikroElektronika website & forums.
Author
Message
alvaro
Posts: 41
Joined: 20 Mar 2013 11:40

Help with USB HID BootLoader for PIC24FJ

#1 Post by alvaro » 04 Sep 2013 12:15

Hi. I'm changed my design from PIC18FJ to PIC24FJ to manage a TFT display with Visual TFT. The problema is that I choosen a PIC24FJ and the example from MIKROMEDIA is with PIC24EP. I need the USB HID BootLoader because the downloaded from the page of MIKROMEDIA not run at PIC24FJ.
Please, can you help me about this?
Thanks in advance.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Help with USB HID BootLoader for PIC24FJ

#2 Post by filip » 05 Sep 2013 08:54

Hi,

If I understand you correctly, you need an USB HID Bootloader for mikromedia for PIC24 ?
It can be downloaded from the mikromedia's webpage :
http://www.mikroe.com/mikromedia/pic24/

Regards,
Filip.

alvaro
Posts: 41
Joined: 20 Mar 2013 11:40

Re: Help with USB HID BootLoader for PIC24FJ

#3 Post by alvaro » 05 Sep 2013 15:42

Hi. Thanks for the reply. I have downloaded this firmware but not work.
(Edited. Sorry)
I think it's OK. Can you help me?
I tryed the TFT and works fine but not the USB.
Last edited by alvaro on 11 Sep 2013 14:44, edited 1 time in total.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Help with USB HID BootLoader for PIC24FJ

#4 Post by filip » 06 Sep 2013 08:43

Hi,

If I'm correct, you are using different MCU than the one used on the mikromedia for PIC24 board,
so you should modify the USB HID bootloader example to suit your MCU.

You can find the bootloader source code on the following location in the compiler :
..\Examples\Other\USB HID Bootloader\

Regards,
Filip

alvaro
Posts: 41
Joined: 20 Mar 2013 11:40

Re: Help with USB HID BootLoader for PIC24FJ

#5 Post by alvaro » 06 Sep 2013 09:35

Thanks Filip. There are something to configure in project? I have changed the MCU type but not work still. Thanks.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Help with USB HID BootLoader for PIC24FJ

#6 Post by filip » 09 Sep 2013 10:47

Hi,

In the main source file you will see a note on the top which explains how to modify the code for your MCU.

Regards,
Filip.

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: Help with USB HID BootLoader for PIC32 3.3.1 version

#7 Post by Rotary_Ed » 13 Sep 2013 15:58

I have attempted several times to use the instructions at in the header of the USB_HID_Bootloader source code to develop my bootloader code - without success.

Even after correcting the error in the _FLASH_ERASE constant value, it still would not work. :shock:

1. Even after complying with the instructions - the compiler complained that not all the files it needed were there after following the instructions. For instance, it also gave an error that USB_Driver.inc was needed in the new project folder as well as the "TYPE" folder and code.
2. Then after finally getting it to compile without any complaints from the compiler, I loaded it to my easyPICFusion v7 board.

The USB-HID tool never recognized any USB device on the board :x .

So finally, I just took the original source code folder for the PIC32MX795F512L (The example), changed the _FLASH_ERASE constant value to 1024 and compiled it as it was. This compiled, loaded and worked fine.

So I suspect, but can not point out where, there is something in the source codes 5 steps that is missing or I am misunderstanding.
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Help with USB HID BootLoader for PIC24FJ

#8 Post by filip » 16 Sep 2013 13:37

Hi,

Could you share with us the code that you were having problem with ?

Regards,
Filip.

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: Help with USB HID BootLoader for PIC24FJ

#9 Post by Rotary_Ed » 16 Sep 2013 14:06

Hi fillip,

Certainly, will send you the code next posting.

However, I did get the bootloader code to work by changing the _FLASH_Erase value to 1024 and then just compiling the example code changing only the PIC chip type. That worked.

My attempt to follow the instructions for making my own bootloader code would compile without error - however, not until after I added several files that are not listed in the instructions. But, even after it compiled without error - the bootloader code in the PIC32MX795F512L chip on my easy PIC Fusion V7 board would not respond to the USB HID tool.
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: Help with USB HID BootLoader for PIC24FJ

#10 Post by Rotary_Ed » 16 Sep 2013 15:19

Ok, fillip, attached are two folders.

1. USB HID BOOTLOADER.zip has screen shots of the IDE at various stages as I followed the instructions. (Oops too large a file, will have to trim it down and send later)
2. PIC32 Bootload Test 16 Sept 2013.zip has the files I compiled in unsuccessful attempt to build my own bootloader code

The two Libraries I checked for the project were the FLASH and the USB libraries.

I was successful after taking the original example code, changing it for the PIC32MX795F512L chip and setting

// Flash memory blocks
const FLASH_ERASE_BLOCK = 1024;//_FLASH_ERASE;

in the CONFIG.file.

I had to also add the USB_DRiver.inc and the TYPE file in order to get it compile without errors
I then load that code to the board and the USB_HID tool recognized the USB device on the board. I successfully load operational code (very fast- that was great with the USB bootloader) and ran it on my easyPIC Fusion V7 board.

First, I may simply have misunderstood the instructions in the header. But, the fact that I could not get it to compile without adding a couple of extra files not mentioned in the instructions - it could be the instructions are not complete. OR I simply am not interpreting them correctly.

A key thing was even the original code had to have the FLASH_ERASE_BLOCK changed from whatever the library value is to 1024 before it would work.

Let me know what you find.
Attachments
PIC32 Bootload Test 16 Sept 2013.zip
(218.41 KiB) Downloaded 351 times
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: Help with USB HID BootLoader for PIC24FJ

#11 Post by Rotary_Ed » 16 Sep 2013 15:30

Ok, fillip

Here are some of the screen shots that may help you understand what I did
Attachments
2.USB HID BOOTLOADER.zip
(245.4 KiB) Downloaded 422 times
USB HID BOOTLOADER.zip
(133.22 KiB) Downloaded 386 times
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Help with USB HID BootLoader for PIC24FJ

#12 Post by filip » 19 Sep 2013 10:19

Hi,

I have tested your example using the 1024 as FLASH_ERASE_BLOCK and the bootloader didn't work as expected.
Then I have set the FLASH_ERASE_BLOCK to default value - _FLASH_ERASE constant and it worked as it should.

Also, I have changed the config bits according to the hardware I tested - PLL x8.
Please find the working example in the attachment.

Regards,
Filip.
Attachments
PIC32 Bootload Test 16 Sept 2013.rar
(22.99 KiB) Downloaded 338 times

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: Help with USB HID BootLoader for PIC24FJ

#13 Post by Rotary_Ed » 19 Sep 2013 12:26

Ok, filip

Thanks, I will give the code a try and get back to you with the results
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: Help with USB HID BootLoader for PIC24FJ

#14 Post by Rotary_Ed » 19 Sep 2013 13:57

Ok, filip,

I compiled the source code you sent back (which as I understand it is simply my original code but with the FLASH_ERASE_BLOCK = _FLASH_ERASE), it compiled and load successfully. In other words, it works as advertised.

So, I went back to my original code that I had sent you and changed the FLASH_ERASE_BLOCK = _FLASH_ERASE. I compiled and loaded, however the PC provided a message that the "USB Device not recognized" - and it would not bootload and the USB-HID tool never received any indication that the bootloader code was present.

So someplace there must be something else that was changed, I'll look into it and see if I can spot it.

Ok, finally got my code working. Here is what I discovered was incorrect in my original project

1. It turns out that when I built my own program, for some reason the configuration from the Mikro Example program did not transfer. For some reason, I had assumed they would - but in reflection realize that while the "New Project" steps undoubtedly sets the configuration bits to some generic set and that my assumption they would automatically transfer was false.

Specifically I found that
All of my USB configuration bits were disabled - so naturally USB did not work. I reset them to match your configuration bits.
I opened up the code you returned (that did work) and checked all my configuration bits against the ones in your codes, the only significant difference was that the USB configuration bits in my code were all disabled, so I enabled them and recompiled.

Still did not work!!

So I printed out the compile Log for both programs and noticed in the command line that your code had -fo80- whereas mine had -fo10 - hummm, says I. Yep! you guessed it, I found my Osc freq set at 10 MHz rather than 80 mhz.

So I corrected that and YEAH! my code finally worked.

I guess I expected the configuration bits to transfer over when I made my new project - but, clearly they did not - or else I did something that changed them - perhaps like loading a different schema although I don't recall ever doing that.

So thanks for your assistance, filip, greatly appreciate it. Always helpful to know where I screwed up.

I have learned not to make assumptions about configuration bits.
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

alvaro
Posts: 41
Joined: 20 Mar 2013 11:40

Re: Help with USB HID BootLoader for PIC24FJ

#15 Post by alvaro » 29 Jul 2014 13:03

Hi again,
I'm trying that the PC recognizes the PIC24FJ256GB106 but it's impossible. I've used the example for bootloader but I can't comunicate between PC and PIC.
I've changed the configurations bits but it's not work.
I've solded the wires directly to D- and D+ and ground.
Please, can anyone help me. Thanks in advanced.

Post Reply

Return to “Website & Forums General Discussion”