picprojects.net Forum

picprojects.net Forum
It is currently Sun Jul 22, 2018 6:41 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: LVP (key sequence) ICSP Programmer using USB Serial Adapter
PostPosted: Fri Apr 01, 2016 4:39 pm 
Offline

Joined: Wed Mar 16, 2016 3:32 pm
Posts: 10
Thanks to excellent cooperation with Christian I found out the following solution to low-voltage (key sequence) program a PIC directly with a USB to Serial UART adapter.
Tested hardware:
- PIC16F1507 (newer generation without PGM pin, key sequence is used to enter LVP mode)
- CP2102 based USB to Serial UART adapter. 3,3V TTL signal, 5V tolerant inputs, rx, tx, dtr, rts and cts pins provided.
- 1 resistor 1k to 10k, 1 si-diode 1N400x or 1N4148...

Additional information can be found in the thread:
http://www.picprojects.net/forum/viewtopic.php?f=4&t=20833&sid=25b6d973403a96e55d7b615134b1a3f3

Attachment:
File comment: Tested hardware schema
LVP_schema.png
LVP_schema.png [ 8.94 KiB | Viewed 4781 times ]


The ICSP connecor X1 is compatible to the pinout of PICkit3 and can be used for HVP and LVP.
The LVP programmer is used to provide the supply and connect the data lines between the USB-Serial adapter and the ICSP connector.
Power supply can be between 3.3V and 5.0V. The diode is used to reduce the supply voltage about 0.7V to ensure the PIC detects the 3.3V HIGH signal of the USB-Serial adapter correctly. 2 diodes in series can be used, if problems occur.

The programming speed is quite slow due to the latency of USB, which is min. 1ms in the best case and can be even longer depending on the number of connected devices and CPU load on the PC. A small test program of 47 words took 24 sec for download and verify, the complete program memory of 2k words took several minutes (around 9).
A first test version increased the speed to 8 sec / 90 sec and Christian stated that he has ideas to make it even faster.
As the download alone is quite fast, maybe there could be an option in PICPgm to not verify the complete program memory automatically with each download.
In general I believe this is a cheap and simple solution for hobbyists and education. Programming hardware is available for less than 3€!

Programmer configuration for PICPgm V1.9.0.0 in pgmifcfg.xml:
Code:
    <PgmIf name="LVP KeySeq Programmer" typ="LVP" connection="COM" jdm_charge_pump="disable" bit_sample_delay="1">
        <PinCfg name="MCLR" pin="3" invert="1" reset_pin="0" reset_invert="0" />
        <PinCfg name="PGM" pin="0" invert="0" />
        <PinCfg name="CLK" pin="4" invert="1" enable_pin="0" enable_invert="0" />
        <PinCfg name="DOUT" pin="7" invert="1" enable_pin="0" enable_invert="0" />
        <PinCfg name="DIN" pin="8" invert="1" />
    </PgmIf>


Starting with V1.9.1.0 the unit of bit_sample_delay was changed to microsecs, so the programmer configuration should be like:
Code:
    <PgmIf name="LVP KeySeq Programmer" typ="LVP" connection="COM" jdm_charge_pump="disable" bit_sample_delay="1000">
        <PinCfg name="MCLR" pin="3" invert="1" reset_pin="0" reset_invert="0" />
        <PinCfg name="PGM" pin="0" invert="0" />
        <PinCfg name="CLK" pin="4" invert="1" enable_pin="0" enable_invert="0" />
        <PinCfg name="DOUT" pin="7" invert="1" enable_pin="0" enable_invert="0" />
        <PinCfg name="DIN" pin="8" invert="1" />
    </PgmIf>


I successfully tested bit_sample_delay starting at 300 while some PCs need values up to 2000.

I hope this solution is valuable for a lot of PICPgm users!
Regards,
Peter


Top
 Profile  
 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group