Author Topic: 8-bit PIC programmer using an Arduino  (Read 1504 times)

0 Members and 1 Guest are viewing this topic.

Offline jfedison741Topic starter

  • Contributor
  • Posts: 33
  • Country: us
8-bit PIC programmer using an Arduino
« on: October 15, 2021, 09:30:26 pm »
Hello,
I have been using a-p-prog (developed by jaromir-sukuba see https://github.com/jaromir-sukuba/a-p-prog) to program a PIC16LF1902 and it is working fine for smaller code sizes, but as soon as I get above about 40% Flash usage, the code tries to run but then seems to be resetting itself at a certain point (LED blinks erratically instead of at the expected 1 sec intervals).  Even though the a-p-prog loader does not report any errors while loading, the code on the PIC does not run when file size is above approx. 40% Flash. When I load the same code using an old PIC programmer, the code runs fine.

Anyone have experience using a-p-prog to program an PIC16LF1902 (or similar)?

This part allows a max Vdd of 3.6 V so I am using 3.3 V on the Vdd pin of the PIC and also using bi-directional level shifter between the 5 V Arduino and the 3.3 V PIC (on the ICSPDAT, ICSPCLK and MCLR lines). It appears a-p-prog was designed to be used only with 5V/16MHz Arduinos as I could not get it to run with a 3.3 V/8MHz Arduino. I don't think the level shifting is a problem as smaller programs work correctly while larger ones (all using a-p-prog as programmer) don't.
 

Offline jfedison741Topic starter

  • Contributor
  • Posts: 33
  • Country: us
Re: 8-bit PIC programmer using an Arduino
« Reply #1 on: October 16, 2021, 01:30:08 am »
Update: Problem solved.

After looking at the device file "pp3_devices.dat", it seems the parameters for the PIC16LF1902 part were a bit off. For this part, the flash size is 4096 bytes and the page size is 64 bytes. I adjusted the PIC16LF1902 line of pp3_devices.dat to read:

16lf1902  4096   64 2C20 FFE0 CF_P16F_A

After that I tried to load a large hex file and it now appears to be loading correctly.

(I have not tested any other parts in PIC16LF19xx family but it looks like some of those may also need similar corrections in the pp3_devices.dat file.)

I would submit an update to a-p-prog on github but currently don't know how.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3032
  • Country: us
Re: 8-bit PIC programmer using an Arduino
« Reply #2 on: October 16, 2021, 03:22:30 am »
I would submit an update to a-p-prog on github but currently don't know how.

You can just open up an issue and explain your fixes.

- go to: https://github.com/jaromir-sukuba/a-p-prog/issues
- click on the "New issue" button in the upper right

You might have to be logged into github (i.e. have an account.)

Otherwise you have to clone the repo, make and commit the changes in your repo and then create a PR (pull request) in the original repo.

Here's a video:

- Creating a Simple Github Pull Request -- Jake Vanderplas
https://youtu.be/rgbCcBNZcdQ
« Last Edit: October 16, 2021, 03:25:06 am by ledtester »
 
The following users thanked this post: Sergeant82d

Offline jaromir

  • Supporter
  • ****
  • Posts: 337
  • Country: sk
Re: 8-bit PIC programmer using an Arduino
« Reply #3 on: October 16, 2021, 07:26:35 am »
Or alternatively, you can contact me here. I'll fix the problem you found, thanks.
 
The following users thanked this post: jfedison741


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf