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 support@ccsinfo.com

18F4550 + Enhanced CPU
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rwskinner



Joined: 08 Dec 2006
Posts: 125
Location: Texas

View user's profile Send private message

18F4550 + Enhanced CPU
PostPosted: Tue Apr 13, 2010 12:56 pm     Reply with quote

I have the following fuses, all work except for the Enhanced CPU keeps being written as turned off. Any way to force the XINST fuse?
I'm using version 4.106

Code:

#FUSES XINST                    //Extended Instruction
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES HSPLL
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES USBDIV
#FUSES PLL5
#FUSES CPUDIV1
#FUSES VREGEN                   //Voltage Regulator
#FUSES NOPBADEN                 //Digitals
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 13, 2010 12:59 pm     Reply with quote

To my knowledge, CCS does not support the Extended Instruction Set.
We have had many threads on this forum where it was used, and the
program behaved very strangely. Upon changing to NOXINST, it started
to run correctly. So if CCS is forcing it to be off, they are doing it to
save you.
rwskinner



Joined: 08 Dec 2006
Posts: 125
Location: Texas

View user's profile Send private message

PostPosted: Tue Apr 13, 2010 1:08 pm     Reply with quote

Good enough then I have to scrap the Diolan HID Bootloader.

I would use the Microchip HID Bootloader but for some reason after I upgraded I get "xx can not fit in section" and I'm told it's because I'm using the lite or eval version. Bummer.
logical



Joined: 21 Dec 2009
Posts: 57
Location: SouthPort, UK

View user's profile Send private message Visit poster's website

PostPosted: Fri Nov 12, 2010 11:52 pm     Reply with quote

Dunno if any interest to you but I use it without problems on a 18f2550.

Had to set the xinst bit option in winpic (programming software) then I use the CCS with the noxinst fuse.
I am not sure if the bootloader therefore runs with xinst and the regular ccs code loads the noxinst fuse thereby disabling it when running the operating code.
Would need some input from someone with more knowledge than me BUT the bootloader and regular operating code work absolutely fine.

If you are still determined to use then I will dig out a tutorial for modifying the diolan bootloader, there are a few pitfalls that are easily overcome with that external tutorial.

Chris

infact scrap that, found the link for the tutorial, hope it helps:
http://www.nilok.ca/products/bootloader/page3.php
_________________
www.SmallDisplays.co.uk due to lack of time, the domain will more than likely be for sale, pm me if interested
Scottzilla



Joined: 17 Jul 2012
Posts: 14

View user's profile Send private message

PostPosted: Sat Dec 08, 2012 5:59 am     Reply with quote

I know this is way old, but did anybody save a copy of this tutorial? It doesn't seem to be online anymore.
logical



Joined: 21 Dec 2009
Posts: 57
Location: SouthPort, UK

View user's profile Send private message Visit poster's website

PostPosted: Sat Dec 08, 2012 6:38 am     Reply with quote

Scottzilla wrote:
I know this is way old, but did anybody save a copy of this tutorial? It doesn't seem to be online anymore.


You could not have asked at a better time, totally correct about the tutorial being no longer avail BUT having spent the last few days working on the boot loader, I would be able to shed some light on it, I have it fully compiled and working as of Thursday as planning to use in a product again.

It would also be great if a much better programmer than myself could post their views on the topic of my previous post regarding enabling the XINST fuse for the boot loader BUT using the NOINST Fuse option in CCS, am I just lucky that my code works flawlessly with it or does the compiler simply not use the instructions that would break it.

Regards

Chris

@PCM, Could you share your view on this.
_________________
www.SmallDisplays.co.uk due to lack of time, the domain will more than likely be for sale, pm me if interested
logical



Joined: 21 Dec 2009
Posts: 57
Location: SouthPort, UK

View user's profile Send private message Visit poster's website

PostPosted: Sat Dec 08, 2012 10:27 am     Reply with quote

Which bit are you stuck on anyway?

Chris
_________________
www.SmallDisplays.co.uk due to lack of time, the domain will more than likely be for sale, pm me if interested
Scottzilla



Joined: 17 Jul 2012
Posts: 14

View user's profile Send private message

PostPosted: Sat Dec 08, 2012 5:08 pm     Reply with quote

Well, I got it to compile, it's talking to my PC over USB, and it seems to be writing user code when I tell it to. Now I need to make it play nice with my user code. It doesn't look like it ever runs, but that may be due to the fact that the EEPROM mark never seems to clear and it always goes right back into bootloader mode.

Also, I'm a little worried about this whole extended instruction set thing. I know the Dangerous Prototypes guys made a version that doesn't use the extended instruction set, but theirs doesn't support the xtea encryption, which I'd like to have.

I'm about to make a simple blinky LED program to help me test.

FYI: PIC=18F4553, Compiler=4.135, Using MPLAB
logical



Joined: 21 Dec 2009
Posts: 57
Location: SouthPort, UK

View user's profile Send private message Visit poster's website

PostPosted: Sat Dec 08, 2012 6:50 pm     Reply with quote

Scottzilla wrote:
Well, I got it to compile, it's talking to my PC over USB, and it seems to be writing user code when I tell it to. Now I need to make it play nice with my user code. It doesn't look like it ever runs, but that may be due to the fact that the EEPROM mark never seems to clear and it always goes right back into bootloader mode.

Also, I'm a little worried about this whole extended instruction set thing. I know the Dangerous Prototypes guys made a version that doesn't use the extended instruction set, but theirs doesn't support the xtea encryption, which I'd like to have.

I'm about to make a simple blinky LED program to help me test.

FYI: PIC=18F4553, Compiler=4.135, Using MPLAB



Totally agree about the XINST, it is not something I ever enable in the Compiler, only the Fuses of the Bootloader.
Perhaps I am just plain lucky, ever since design a few years ago, I have a Fuel Management System running over this Bootloader with no problems at all and have just redone the bootloader as I sadly lost the .hex + MPLAB Project and need for a totally different project.

I have also PM'd PCM_Programmer and will hopefully get a post from him on this topic.

If it is programming then looping back in to the bootloader, have you changed the XTEA Key in MPLAB and also the one for the Encoder?
I can gladly post my working code BUT bear in mind that I will have to remove any Keys etc and also it is for a 18f2550.

I will also dig a link out for a French site which shows a few walkthroughs, just use your browser to translate it.

Last but not least, something I did see in the Examples is that there is an XTEA Encryption Routine which would be possible to use with something like the Bootloader Example as another option due to the XINST concerns BUT genuinely, has not applied to mine what so ever.
_________________
www.SmallDisplays.co.uk due to lack of time, the domain will more than likely be for sale, pm me if interested
logical



Joined: 21 Dec 2009
Posts: 57
Location: SouthPort, UK

View user's profile Send private message Visit poster's website

PostPosted: Sun Dec 09, 2012 10:03 am     Reply with quote

@Scottzilla

Try this, see if it helps, will have to use your browser to translate in case you don't speak French.

Chris


http://www.laurentclaude.fr/articles/pic-et-usb.html
_________________
www.SmallDisplays.co.uk due to lack of time, the domain will more than likely be for sale, pm me if interested
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Dec 09, 2012 2:26 pm     Reply with quote

Did you read this recent thread on the Extended Instruction Set:
http://www.ccsinfo.com/forum/viewtopic.php?t=49431
logical



Joined: 21 Dec 2009
Posts: 57
Location: SouthPort, UK

View user's profile Send private message Visit poster's website

PostPosted: Sun Dec 09, 2012 2:38 pm     Reply with quote

Thanks PCM

I presume then it totally depends on what functionality you are running with the code etc.
In my application, it is not a problem at all and works reliably BUT I always use the NOXINST Fuse in CCS so that the compiler does not attempt to use the extended set anyway.
_________________
www.SmallDisplays.co.uk due to lack of time, the domain will more than likely be for sale, pm me if interested
Scottzilla



Joined: 17 Jul 2012
Posts: 14

View user's profile Send private message

PostPosted: Tue Dec 11, 2012 3:49 am     Reply with quote

It's no longer stuck in bootloader mode. That French article pointed out a bug and that's what was causing it:

Quote:
Fixed a bug:

In the boot.asm file has slipped a shell that prevents the good start of the bootloader. It is sufficient just to switch lines 146 and 147, here's the corrected code:

Code:

  ; Decide what to run bootloader or application
 #if USE_EEPROM_MARK
  ; Check EEPROM mark
  movlw  EEPROM_MARK_ADDR
  movwf  EEADR
  movlw  0x01
  movwf  EECON1
  movlw  EEPROM_MARK
  subwf  EEDATA, W
  bz  bootloader
#endif
  ; Check bootloader enable jumper
#ifdef USE_JP_BOOTLOADER_EN
  setf  JP_BOOTLOADER_TRIS
  btfsc  JP_BOOTLOADER_PORT, JP_BOOTLOADER_PIN
#endif
  goto  APP_RESET_VECTOR  ; Run Application FW
  ; Run bootloader
  bra  bootloader
  reset


Now to go make my code run.
Scottzilla



Joined: 17 Jul 2012
Posts: 14

View user's profile Send private message

PostPosted: Wed Dec 26, 2012 5:05 pm     Reply with quote

The code won't run. I made some simple blinky-led code, which runs fine when programmed directly. I used #build to move the reset vector to 0x800 (I moved the interrupt vector too, but this test code doesn't use interrupts)

Code:
#build(reset=0x800)  //Remap reset vector
#build(interrupt=0x808)  //Remap interrupt vector


I used the encoder program (encoder.exe) to encode the .hex file using a 16 bit hex key.

I compiled the bootloader with a matching key in xtea.asm.

I am able to connect to my device via usb.

Using fw_update, erase/program/verify all seem to work fine.

After my device restarts, it is in user program mode and not bootloader mode.

Everything seems to work fine right up until it's time for the user code to run, and it doesn't. I feel like I'm past the hard part and I'm missing something obvious.
Scottzilla



Joined: 17 Jul 2012
Posts: 14

View user's profile Send private message

PostPosted: Wed Dec 26, 2012 9:32 pm     Reply with quote

Turned out to be an encryption key problem. I wasn't formatting it right when specifying it in xtea.asm. Using "abcdefghijklmnop" in the .asm file and 6162636465666768696a6b6c6d6e6f70 in the command line utility when encrypting the file seems to work. LED is blinking now.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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