CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Problem with Microchip HID bootloader and CCS CDC software

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
micro_debugger



Joined: 08 Oct 2009
Posts: 73

View user's profile Send private message

Problem with Microchip HID bootloader and CCS CDC software
PostPosted: Thu Oct 08, 2009 2:06 pm     Reply with quote

Dear All,

I'm using Microchip HID bootloader (the latest Version) with PIC18F14K50.
When I'm using it with CDC demo from Microchip, it is working perfectly. When I'm using it with CCS (the latest version 4.099) compiler, it is working, but with problems. The same sample program based on CCS CDC example loaded to the chip without HID bootloader is working very well. I have indicated that problem is in the
Code:
      if (usb_enumerated()) ...

line. The usb_enumerated() never goes "1". However, I can not understand why the same program is working very well without boot loader. I have tested other CCS programs (not usb) and are working very good with the same boot loader. So, my question is :
Has anybody experience with this configuration CCS+PIC18F14K50+MC HID bootloader. Thank you very much for your help.

Please see here below exact listing of my CCS software, and header adopting it to HID bootloader.

My CDC software listing:
Code:

#include <18F14K50.h>
#use delay(clock=48M)

#include "C:\Users\MASTER\Desktop\CCS_CDC_HID\my_HID_USB_BOOTLOADER.h"
#include <usb_cdc.h>

#rom int 0xf00000={1,2,3,4}

#ZERO_RAM

#FUSES CPUDIV1                  //System Clock by 1
#FUSES USBDIV1
#FUSES HS
#FUSES PLLEN
#FUSES NOFCMEN
#FUSES NOIESO
#FUSES NOPUT
#FUSES NOBROWNOUT
#FUSES BORV30
#FUSES NOWDT
#FUSES WDT32768
#FUSES NOMCLR
#FUSES NOHFOFST
#FUSES STVREN
#FUSES NOLVP
#FUSES NOXINST
#FUSES BBSIZ2K

#define MY_READ_EEPROM(x)    read_eeprom(x)
#define MY_WRITE_EEPROM(x, y)   write_eeprom(x, y)

void main(void)
{
BYTE i, j, address, value;


   usb_init_cs();

   do
   {
      usb_task();

      if (usb_enumerated())
      {
         if (usb_cdc_kbhit())
         {
            i = toupper(usb_cdc_getc());
           
            if (i == 'R')
            {
               printf(usb_cdc_putc, "\r\n\nEEPROM:\r\n");              // Display contents of the first 64
               for(i=0; i<=3; ++i)
               {
                  for(j=0; j<=15; ++j)
                  {
                     printf(usb_cdc_putc, "%2x ", MY_READ_EEPROM( i*16+j ) );
                  }
                  printf(usb_cdc_putc, "\n\r");
               }
            }
           
            if (i == 'W')
            {
               printf(usb_cdc_putc, "\r\n\nLocation to change: ");
               address = gethex_usb();
               
               printf(usb_cdc_putc, "\r\nNew value: ");
               value = gethex_usb();
     
               MY_WRITE_EEPROM(address, value);
               
               printf(usb_cdc_putc, "\r\n");
            }
           
            printf(usb_cdc_putc, "\r\nR)ead memory or W)rite Memory");           
         }
      }
   } while (TRUE);
}


My CDC bootloader adaptation header:
Code:

///////////////////////////////////////////////////////////////////////////
////                                                                   ////
////                     MY_USB_BOOTLOADER.H                           ////
////                                                                   ////
///////////////////////////////////////////////////////////////////////////

#define LOADER_SIZE                 (0x0FFF)
#define LOADER_START                (0)
#define LOADER_END                  (LOADER_SIZE)
#define APPLICATION_START           (LOADER_SIZE+1)
#define APPLICATION_END             (getenv("PROGRAM_MEMORY")-1)
#define APPLICATION_ISR             (APPLICATION_START + 08)

#build(reset=APPLICATION_START, interrupt=APPLICATION_ISR)

#org 0,LOADER_END AUTO=0 void bootloader(void) {}

Thank you in advance for help
Kind Regards
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Thu Oct 08, 2009 4:47 pm     Reply with quote

You should check the initialisation performed in the C18 crt-startup files. Generally, the bootloader jumps to your application
after setting up several processor registers. It's not the default processor state as expected by the CCS code.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri Oct 09, 2009 3:51 am     Reply with quote

Another point, I forgot to mention. Are the fuses set in the HID-Bootloader or did you overwrite them when programming your application? Did you verify, that the settings are compatible?
micro_debugger



Joined: 08 Oct 2009
Posts: 73

View user's profile Send private message

PostPosted: Fri Oct 09, 2009 2:42 pm     Reply with quote

Thank you very much for your reply. I will check mentioned points and give you an update.

Kind regards
PICoHolic



Joined: 04 Jan 2005
Posts: 224

View user's profile Send private message

PostPosted: Mon Oct 12, 2009 8:03 am     Reply with quote

One thing to mention is that, try to add the following line to the beginning your hex file:
:020000040000FA

I had similar problem before.

Good Luck
micro_debugger



Joined: 08 Oct 2009
Posts: 73

View user's profile Send private message

PostPosted: Mon Oct 12, 2009 4:50 pm     Reply with quote

Hi,

I found your previous post about this extra line, and add it already.

Thank you
ljunior



Joined: 26 Apr 2011
Posts: 4
Location: Brazil

View user's profile Send private message

PostPosted: Tue Apr 26, 2011 6:43 pm     Reply with quote

Hi micro_debuger

Did you solved this problem? I'm having the same.

Att
fkl



Joined: 20 Nov 2010
Posts: 44

View user's profile Send private message

PostPosted: Sat May 25, 2013 11:25 pm     Reply with quote

Hi

Did you solved this problem? I'm having the same.

Help...
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group