Skip to main content
Topic: Adding support for 18F4550 (Read 8043 times) previous topic - next topic

Adding support for 18F4550

I changed the pic.c file to add support for 18F4550, however I couldn't test it as I get "Error sending data" messages after "Entering binary mode" message. I just ran the 18F2550 example at the wiki by changing 2550 to 4550. I get these errors both in firmware v5.9 and v5.10, maybe something broken?

I'm also attaching my pic.c file. The only difference should be in the device ID section as 2550 and 4550 have the same memory map but my calculations for flash memory differ: 2550 has 0x160000, but the datasheet says flash size is 32 KB (kilobytes) so I used 32*1024. Is there a mistake in my calculations?

I have a circuit on breadboard, might be able to work some more tomorrow, getting sleepy now.

Re: Adding support for 18F4550

Reply #1
There is a guide to adding pics and the memory stuff on the wiki. I'm a little unclear on it myself unless I look at the code.
Got a question? Please ask in the forum for the fastest answers.

Re: Adding support for 18F4550

Reply #2
second addition of pic ..

i think you should send the addition as patch, after a thousand or so, it will become very unmanageable.

Re: Adding support for 18F4550

Reply #3
[quote author="robots"]
second addition of pic ..

i think you should send the addition as patch, after a thousand or so, it will become very unmanageable.
[/quote]

I agree, or some kind of database/script to generate the pic.c.

Re: Adding support for 18F4550

Reply #4
I posted the file to show the differences between 2550 and 4550, here is a patch. Named the old pic.c file as pic-old.c then made changes so the patch file is according to that.

Also couldn't make the program work tonight, I'll try my windows machine tomorrow, it might be related to sth between Linux and Windows. Any type of suggestions? I'm kind of lost here.

Re: Adding support for 18F4550

Reply #5
Got it to work! :D

Code: [Select]
tayken@tayken-eee:~/Downloads/PiratePICprog-read-only$ ./picprog -p buspirate -u /dev/buspirate -s 115200 -c 18F4550 -E
(Bus) Pirate PIC Programer v0.2

Initializing interface
115200
Entering binary mode
BP: Setup mode...
Setup peripherals...
(OK)
Found '18F4550' in programming database :) index = 1
Checking for 18F4550 attached to programmer...
Found 18F4550 (0X1207, ID: 0X90 REV: 0X7)
Erasing chip... OK :)
tayken@tayken-eee:~/Downloads/PiratePICprog-read-only$

Ran into two problems:
1) "Error sending data" message worried me before, and I stopped the operation. This time, I just let it sit and once it connects, the operation is smooth, never got the same errors again. But if you unplug and plug, you get the same error the first time.
2) After checking everything again and again, I got the same error about wrong ID. I suspected that the BP is not powering up the board, so I checked it out with a multimeter, seems I was right. I disconnected the jumper and fed the board externally, which made it work! I will trace my board to see why I cannot get any voltage output.

Re: Adding support for 18F4550

Reply #6
Just a quick note, more tomorrow: I think you have to specify the power in the pic programming app. It should be available, it is part of the raw wire library where the pic com ands are.
Got a question? Please ask in the forum for the fastest answers.

Re: Adding support for 18F4550

Reply #7
[quote author="tayken"]
2) After checking everything again and again, I got the same error about wrong ID. I suspected that the BP is not powering up the board, so I checked it out with a multimeter, seems I was right. I disconnected the jumper and fed the board externally, which made it work! I will trace my board to see why I cannot get any voltage output.
[/quote]

In the user mode the buspirate reads the voltage after enabling the voltreg, if the voltage didn't rise fast enough it is switched off. I assume the binary mode does the same.. The voltreg can only supply 150mA at most, so what more is on your board?

Re: Adding support for 18F4550

Reply #8
I took a double usb cord from an old portable hard drive and hacked the end off so I could attach a mini usb end for the bus pirate. heat shrink tubed it up and all. so my bus pirate gets juice from two usb ports. I was having issues powering a 4 line 20 character lcd off the bus pirate before

Re: Adding support for 18F4550

Reply #9
I ran some more tests, I can see that the power LED blink when it starts to program, probably voltage rise is not fast enough. You can see the schematic of the board I'm using in this link.

Re: Adding support for 18F4550

Reply #10
There is no diode between the mclr resistor and the power supply. I'd try to add one if possible. Microchip recommends it, and I bet the current draw and/or voltage divider formed is causing some problems.
Got a question? Please ask in the forum for the fastest answers.

Re: Adding support for 18F4550

Reply #11
Oh, I see now!Possibly the problem is that. But there is no way that I can add a diode there, there is no place that I can stick a diode. :(

At least we learned that my board has a problem, so I will continue my trials with the USB cable attached. :)