Skip to main content
Topic: PiratePICprog console application (Read 35641 times) previous topic - next topic

Re: PiratePICprog console application

Reply #45
The segfault is happening because the reference is getting messed up by this line:
((struct BP_t *)pBP)->fd = fd;

It's in buspirate.c BP_Init about like 116:

I'm assuming it destroys the whole iface struct. After this line accessing any iface part of picprog causes segfault. As part of my debugging the moved the serial port to a global variable, but this is a super messy change and I'd rather figure out that's going on here and fix it.
Got a question? Please ask in the forum for the fastest answers.


Re: PiratePICprog console application

Reply #47
The problem was actually quite simple. The main.c was passing a picprog_t struct, and the bpinit was treading it as a bp_t struct.

I created a global bp_t struct in buspirate.c and add a reference to it in the picprog_t struct now. Once I figure out the exact pointer stuff it should work (fingers crossed).
Got a question? Please ask in the forum for the fastest answers.

Re: PiratePICprog console application

Reply #48
I got this going, erasing and reading ID. I'm trying to move my changes into the various libraries. I'll probably have a working version tomorrow. My codeblocks project is checked in under robots framework folder.
Got a question? Please ask in the forum for the fastest answers.

Re: PiratePICprog console application

Reply #49
Great job! So it is now just a matter of converting the picprog into your application?

When is the ETA of the HVP adapter? It would be an pitty to have the app ready and the hw not ;)

Re: PiratePICprog console application

Reply #50
I'm going to rotor (http://rotor.ws) to get the female 2x5 today when I get a broodje beenham for lunch. I hope to have programmed the USB IR Toy by the end of the day (might be too ambitious).
Got a question? Please ask in the forum for the fastest answers.

Re: PiratePICprog console application

Reply #51
Eat slowly and you might make it ;)

But when does seeed sell it? ;)

Re: PiratePICprog console application

Reply #52
It's writing now :) Time to get lunch and some parts. Next I'll work on read, then try a console app instead of running it under debug. Getting exciting.
Got a question? Please ask in the forum for the fastest answers.

Re: PiratePICprog console application

Reply #53
Eet ze! ;)

Re: PiratePICprog console application

Reply #54
Ok ok, but one last test. It's reading/verifying now :) Time to clean it up and make a release.
Got a question? Please ask in the forum for the fastest answers.

Re: PiratePICprog console application

Reply #55
I've got the code mostly working now, but it only works under debug, the compiled version just exits.
Got a question? Please ask in the forum for the fastest answers.

Re: PiratePICprog console application

Reply #56
Here's an initial version of the app. It's not final, but it programs the OLS bootloader really fast :) Will be updating the read/write PIC routines soon to maximize speed.
Got a question? Please ask in the forum for the fastest answers.

Re: PiratePICprog console application

Reply #57
I have just returned back and I am really happy you got it going !!!

I should fix/change the Iface init function to return pointer to correct BP_t (xxx_t struct), this would hide the interface completely from higher level. This would also lead to adding "finish" function, that would clean up the interface stuff (and return BP to normal mode).

Re: PiratePICprog console application

Reply #58
It's working well now. I am away this week, but I plan to get it going with the high voltage adapter next week. It takes a long time to write or read with the current protocol, so I'll probably update it for bulk reads and writes that are stored in a buffer in the PIC for maximum speed.
Got a question? Please ask in the forum for the fastest answers.

Re: PiratePICprog console application

Reply #59
I added new bulk read and write command and a buffer layer to the bus pirate interface. It's not very pretty yet, that will come later. Currently limited to the 18F. It erases, programs, and verifies a 18F24J50 in 19.2seconds. That's a huge improvement over the previous method that took minutes. I'll try to get the 24F going tomorrow and make a release when the v5.4 firmware is out.
Got a question? Please ask in the forum for the fastest answers.