picprojects.net Forum

picprojects.net Forum
It is currently Sun Sep 23, 2018 10:27 pm

All times are UTC




Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: PIC16F1507 unknown - LVP via USB Serial
PostPosted: Mon Mar 28, 2016 1:30 pm 
Offline

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

we are making progress ;)
At least we know that the additional delay before sampling the bit is the trick and PICPgm see reads the device ID properly.

I need to check why the device ID is read 2 times. Maybe it is due to some GUI updates or so.

Nevertheless, I think it would be better to think about how we could control the MCLR pin.
What about using a Toggle-FlipFlop for this purpose? I.e. take the TxD of the serial port and use it as input for the Toggle FlipFlop?
We send a pattern (e.g. 0x0F - will generate a high - low - high on TXD) which generates one pulse to toggle the FlipFlop every time we want to change the state of the MCLR pin.

What do you think?

Regards,
Christian


Top
 Profile  
 
 
 Post subject: Re: PIC16F1507 unknown - LVP via USB Serial
PostPosted: Mon Mar 28, 2016 6:32 pm 
Offline

Joined: Wed Mar 16, 2016 3:32 pm
Posts: 10
Hi again!

I did some more testing, because I found out that CP2102 is capable of handling the break command on TX.
So I use TX as Clock now and DTR as PGM/Vdd for automatic reset handling on MCLR directly without a flip flop.

The result is different but still not successful...
The PIC does not get confused anymore and answers correctly 3(!) times (tested with scope).
Here you see the config and the log of test verion C:

Regards,
Peter

Code:
    <PgmIf name="JDM LVP Programmer" typ="LVP" connection="COM" jdm_charge_pump="disable" bit_sample_delay="5">
        <PinCfg name="MCLR" pin="0" invert="0" reset_pin="0" reset_invert="0" />
        <PinCfg name="PGM" pin="4" invert="0" />
        <PinCfg name="CLK" pin="3" 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>


Quote:
Checking connection of JDM LVP Programmer ...
JDM LVP Programmer connected and initialized!
Autodetecting PIC ...
No PIC detected!
JDM LVP Programmer connected and initialized!
Using QueryPerformanceCounter function for microseconds delay.
Testing delay: 100us delay took 100us (loop counter = 100)
CPic16F19xx::ReadDeviceID =0x3c0f
CPic16F19xx::ReadDeviceID =0x3c0f
PIC unknown! Programming may fail!!
Warning: No HEX file selected!


Top
 Profile  
 
 Post subject: Re: PIC16F1507 unknown - LVP via USB Serial
PostPosted: Mon Mar 28, 2016 8:28 pm 
Offline

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

why aren't you using MCLR for MCLR control and use PGM for MCLR control instead?
Isn't PGM pin high during programming with your configuration (MCLR needs to go to low)?

Try the following configuration instead:
Code:
<PgmIf name="JDM LVP Programmer" typ="LVP" connection="COM" jdm_charge_pump="disable" bit_sample_delay="5">
        <PinCfg name="MCLR" pin="4" invert="0" reset_pin="0" reset_invert="0" />
        <PinCfg name="PGM" pin="0" invert="0" />
        <PinCfg name="CLK" pin="3" 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>


PGM configuration controls the PGM pin or VDD for PICs without PGM pin. So it shouldn't be used for any other purpose since it might not work.

Regards,
Christian


Top
 Profile  
 
 Post subject: Re: PIC16F1507 unknown - LVP via USB Serial
PostPosted: Tue Mar 29, 2016 8:11 am 
Offline

Joined: Wed Mar 16, 2016 3:32 pm
Posts: 10
Hi Christian!

Finally I was SUCCESSFUL with your hint - of course MCLR should be used for MCLR! THANK YOU!!! :D
I successfully tested with version 1.9.0.0 and the config:
Code:
    <PgmIf name="JDM LVP 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>


If you are still ambitious to fine-tune the speed I have the following information for you: ;)
1.) Downloading and verifying a small LED test program of 47 words took about 24 sec (bit_sample_delay=1).
2.) If I set bit_sample_delay=0 there is a strange behaviour of MCLR in the second query (see red scope). It stays high during the second cycle, while in the other 3 cycles it behaves correctly. Maybe this is the reason why the PIC is not detected with bit_sample_delay=0...
3.) The timing of the answer from the PIC (with bit_sample_delay=0) is nearly the same as in my fastest successful test with my command line test: 1 bit takes about 750µs. So I see 2 possibilities to make reading faster while respecting the USB timing:
a.) Call ReadDataIn() AFTER the falling edge of the clock - maybe with an additional adjustable microsec-delay before the falling edge of the clock.
b.) Change the precision of bit_sample_delay to microsecs. As the standard precision of the Sleep() function in Windows is 15ms, no shorter delays than this are possible. And 15ms per bit is REALLY slow! ;) An adjustable delay between 100µs and maybe 2000µs or 5000µs should be sufficient for most cases.

THANK YOU for all the time! :D
If you like I can provide a detailled documentation for this solution to be included in the hardware section of your homepage, after we closed the case!
Kind regards,
Peter


Attachments:
File comment: Error(?): MCLR stays high during the second query.
Oszi_bit_sample_delay_0.PNG
Oszi_bit_sample_delay_0.PNG [ 37.61 KiB | Viewed 5311 times ]
Top
 Profile  
 
 Post subject: Re: PIC16F1507 unknown - LVP via USB Serial
PostPosted: Tue Mar 29, 2016 5:55 pm 
Offline

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

that are very good news! :D

I have change "bit_sample_delay" to microseconds in PICPgm 1.9.1.0-rc1.
http://picpgm.picprojects.net/download/ ... 32-x86.exe

Other timing tuning can also be done. I have some ideas, but it will take some time.

It would be great if you could summarize the details about your programmer. This will be very helpful for other users also. A lot of people already asked me in the past whether PICPgm also works with an USB-to-Serial adapter. Now, at least for some USB-to-Serial adapters we have a solution.

Thanks & Regards,
Christian


Top
 Profile  
 
 Post subject: Re: PIC16F1507 unknown - LVP via USB Serial
PostPosted: Wed Mar 30, 2016 6:26 pm 
Offline

Joined: Wed Mar 16, 2016 3:32 pm
Posts: 10
Hi Christian,

Thanks for the new version!
I successfully tested it with a bit_sample_delay=400µs. At least it was 4 times faster and the download and verify of 47 words took 8 sec. The total progam memory of 2k words lasted 90 secs. Not fast, but cheap and ok for test purposes...
The hardware is just a CP2102 USB to UART bridge, a diode and a resistor! :D

How should I provide the documentation?
As a summary of this thread? A new thread? A PDF file?

Kind regards,
Peter


Top
 Profile  
 
 Post subject: Re: PIC16F1507 unknown - LVP via USB Serial
PostPosted: Wed Mar 30, 2016 8:28 pm 
Offline

Joined: Fri Oct 28, 2011 5:18 pm
Posts: 225
Perfect! With some additional timing improvements it might get a little bit faster in the future.
Nevertheless, for programming a bootloader once or for small projects it is quite enough.

Regarding documentation:
A new thread might be the best solution for other users since they do not need to read through the whole history of this thread.
Currently I also have less time to update my website, so if it is present in the forum, people can already access it in the meanwhile. Once I have more time I'll also update the hardware section on the PICPgm website.

Thanks in advance for documentation of this programmer!!
Christian


Top
 Profile  
 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2

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