View previous topic :: View next topic |
Author |
Message |
rwskinner
Joined: 08 Dec 2006 Posts: 125 Location: Texas
|
18F4550 + Enhanced CPU |
Posted: Tue Apr 13, 2010 12:56 pm |
|
|
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
|
|
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 13, 2010 12:59 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
rwskinner
Joined: 08 Dec 2006 Posts: 125 Location: Texas
|
|
Posted: Tue Apr 13, 2010 1:08 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
logical
Joined: 21 Dec 2009 Posts: 57 Location: SouthPort, UK
|
|
Posted: Fri Nov 12, 2010 11:52 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Scottzilla
Joined: 17 Jul 2012 Posts: 14
|
|
Posted: Sat Dec 08, 2012 5:59 am |
|
|
I know this is way old, but did anybody save a copy of this tutorial? It doesn't seem to be online anymore. |
|
![](templates/subSilver/images/spacer.gif) |
logical
Joined: 21 Dec 2009 Posts: 57 Location: SouthPort, UK
|
|
Posted: Sat Dec 08, 2012 6:38 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
logical
Joined: 21 Dec 2009 Posts: 57 Location: SouthPort, UK
|
|
Posted: Sat Dec 08, 2012 10:27 am |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Scottzilla
Joined: 17 Jul 2012 Posts: 14
|
|
Posted: Sat Dec 08, 2012 5:08 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
logical
Joined: 21 Dec 2009 Posts: 57 Location: SouthPort, UK
|
|
Posted: Sat Dec 08, 2012 6:50 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
logical
Joined: 21 Dec 2009 Posts: 57 Location: SouthPort, UK
|
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
![](templates/subSilver/images/spacer.gif) |
logical
Joined: 21 Dec 2009 Posts: 57 Location: SouthPort, UK
|
|
Posted: Sun Dec 09, 2012 2:38 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
Scottzilla
Joined: 17 Jul 2012 Posts: 14
|
|
Posted: Tue Dec 11, 2012 3:49 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Scottzilla
Joined: 17 Jul 2012 Posts: 14
|
|
Posted: Wed Dec 26, 2012 5:05 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Scottzilla
Joined: 17 Jul 2012 Posts: 14
|
|
Posted: Wed Dec 26, 2012 9:32 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
|