picprojects.net Forum

picprojects.net Forum
It is currently Fri Sep 21, 2018 7:29 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: LVP programmer using USB to Serial converter
PostPosted: Sat Jan 03, 2015 9:45 am 
Offline

Joined: Sat Jan 03, 2015 9:22 am
Posts: 3
hi,

i have some success with a simple PIC programmer using the USB to serial adapter.
i have blogged about it here :
http://chaukasalshi.blogspot.in/2014/12/pic-programmer-using-usb-to-serial.html

It also works for HVP, the blog is http://chaukasalshi.blogspot.in/2015/01/pic-programmer-using-usb-to-serial.html

The schematic is as below :
Attachment:
usb2ser_flipflop_pgm.jpg
usb2ser_flipflop_pgm.jpg [ 73.03 KiB | Viewed 9243 times ]



It uses a jk flip-flop that toggles on a pulse from Txd line. This way the PGM line is controlled.
MCLR is tied fixed to VDD.
It works. Earlier, i had problems reading EEPROM, but that is solved now, with a 1K resistor between DTR and PGD.
Thanks to Darron from kewl.org for pointing it out.

Could you take a look and check if it can be added to PicPgm ?

its quite slow, ok for 1st time burning, or burning small files.
it would be good if the programming software has an option to verify only first n bytes of code memory,
rather than all, due to its slow speed. i am able to burn a 500 byte hex file in around 1.5 mins,
provided that i check only the 1st 50 bytes.

regards,
manoj

P.S - a snap of the working circuit on bread board :
Attachment:
20141225_173934.jpg
20141225_173934.jpg [ 85.01 KiB | Viewed 9364 times ]
.jpg[/attachment]


Last edited by manojmo on Fri Jan 23, 2015 7:13 am, edited 3 times in total.

Top
 Profile  
 
 
 Post subject: Re: LVP programmer using USB to Serial converter
PostPosted: Mon Jan 05, 2015 1:49 pm 
Offline

Joined: Fri Oct 28, 2011 5:18 pm
Posts: 225
Hi,

nice design!
Is it really required to have the Flip-Flop? TxD line can also be directly set High or Low (e.g. under Windows with EscapeCommFunction() or Linux with something like ioctl(handle, TIOCCBRK, 0) and ioctl(m_handle, TIOCSBRK, 0)).

I assume that with the proper hardware configuration in pgmifcfg.xml you can get the programmer running with your hardware. Only the delays might be to short.
Are you running it on a Linux PC?

Regards,
Christian


Top
 Profile  
 
 Post subject: Re: LVP programmer using USB to Serial converter
PostPosted: Tue Jan 06, 2015 6:36 am 
Offline

Joined: Sat Jan 03, 2015 9:22 am
Posts: 3
thanks christian :)

in the blog, i have discussed 3 approaches for txd :
1. flip-flop 2. works best.
2. transistor Latch( has to be reset by push-button). works.
3. txd line held high by continuously transmitting on it. this does not work by itself,
probably the rise time is not fast enough. maybe it could work by driving a transistor, i have not tried it.
one more snag could be that a separate thread is needed to transmit on txd, since PGM has to be high
all the time, and this could interfere with the data and clock timings.
( the behaviour of my usb-serial is different from the real serial port, the txd line at idle is at 0 volts
and goes high only when transmititing. never goes -ve )

does PicPgm already support sending a 0x0 for on and off on txd ?
for 0x0, the stop bit at the end would lead to a high,
for some reason, sending a 0x0 gets me more voltage than sending 0xff.

a 5ms delay is required for the clock half-time, as per my tests with the usb-serial converter, in order to read back what was written.
it works with this delay. the facility to verify only 1st n bytes of code would be sorely needed tho, else it will take forever.

yes, i lately switched to linux mint 17 xfe and am loving it.
( i have a win xp dual boot, but have not needed it )

regards,
manoj


Top
 Profile  
 
 Post subject: Re: LVP programmer using USB to Serial converter
PostPosted: Fri Jan 09, 2015 8:22 am 
Offline

Joined: Sat Jan 03, 2015 9:22 am
Posts: 3
i did not understand your comment about TIOCCBRK earlier, now i know about termios and the BREAK functionality to keep sending 0s.
however, it does not work on my cheap Bafo usb-serial adapter. so can't do without the flip-flop, it seems.

If we had an option to use the toggle mode, say VPP_TOOGLE_ON_PULSE, the code might be something like
if( VPP_TOGGLE_ON_PULSE) {
set_tx_toggle_pulse(serial_port, onOff);
}
else {
// the BREAK approach
}

void set_tx_toggle_pulse(int serial_port, int onOff)
{
static int lastOnOff;
unsigned char bytes[1] = {0x00};
if (onOff != lastOnOff) {
write( serial_port, bytes, 1);
lastOnOff = onOff;
}
}


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

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:  
cron
Powered by phpBB® Forum Software © phpBB Group