danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Add small cpu for R/C servo controlled

Mon Jun 24, 2013 5:27 am

Hi Todd,

I check my github , reload it , and didn't find that bug.


Does the code works at least now.

Daniel

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Add small cpu for R/C servo controlled

Mon Jun 24, 2013 5:28 am

Hi Todd,

I check my github , reload it , and didn't find that bug.


Does the code works at least now.

Daniel

Update sorry about that double post. I'm unable to keep connected often and when I post a lot of times I need to relog
Last edited by danjperron on Mon Jun 24, 2013 12:25 pm, edited 6 times in total.

User avatar
joan
Posts: 14174
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Add small cpu for R/C servo controlled

Mon Jun 24, 2013 7:41 am

Some browser/web-site combinations introduce these spurious characters (are they hard spaces?).

To remove those characters do

tr -d "\240\302" <bad-file >good-file

where bad-file is the file with the characters and good-file will be a new file with the characters removed. The < and > symbols are a required part of the syntax.

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Add small cpu for R/C servo controlled

Mon Jun 24, 2013 12:25 pm

Hi Todd,

Could you tell me how you download the code.


From the Raspberry Pi console could you try

Code: Select all

git clone https://github.com/danjperron/A2D_PIC_RPI
and check if the code in the folder A2D_PIC_RPI works.

P.S. you will need to install git

Daniel

Todd Alan
Posts: 6
Joined: Sat Jun 22, 2013 12:59 am

Re: Add small cpu for R/C servo controlled

Mon Jun 24, 2013 4:26 pm

Oops, I'm thinking I need to do these to run the burner too.
1 - in /boot/cmdline.txt removes "console=ttyAMA0,115200 kgdboc=ttyAMA0,115200"
2- in /etc/inittab comment out the last line
"#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100"
3- Install python serial module
sudo apt-get install python-serial

One step at a time :)

T

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Add small cpu for R/C servo controlled

Mon Jun 24, 2013 4:55 pm

Yes you do.

The cmdline.txt is not necessary but it is a good think if the kernel start to send out some debug text.

Daniel

Todd Alan
Posts: 6
Joined: Sat Jun 22, 2013 12:59 am

Re: Add small cpu for R/C servo controlled

Mon Jun 24, 2013 5:35 pm

I copied the code and pasted into leafpad, saved as burnlvp.py.
I do have git and I think I tried that but ended up with all of the html code for the entire page.

I'll do the edits and try again before I try "git" the code.

All of this is giving me euphoric recall, back to the early 90's and dos. Cool stuff :)

Thanks again I have some cool plans for your circuit.

Todd

User avatar
ValterFukuoka
Posts: 101
Joined: Sat Oct 01, 2011 11:39 pm
Location: Japan

Re: Add small cpu for R/C servo controlled

Sun Sep 08, 2013 2:10 pm

danjperron wrote:It is now possible to program the PIC12F1840 using the RapsberryPi without any transistor or resistor.
Image
I just add the application , in python, into my Pic A/D converter Git repository.
https://github.com/danjperron/A2D_PIC_RPI search for 'burnLVP.py'.
Daniel
Hi Daniel (came here from the other post: http://www.raspberrypi.org/phpBB3/viewt ... 9&start=50).

I just tested the burnLVP on a PIC12F1840... works great!

I am looking at the code now...

Want to ask you something...
What is your opinion about the needed change to make it work on a normal PC (Win, Lin) using serial comm port?
More precisely one USB to Serial Adapter that translate RS232 voltage levels to TTL 5Volts...
This is exactly what I am trying to imagine looking at the source code...
Looks feasible to me... don't know if there are any problem...
What do you think?

Besides this possibility, I want to use it (burnLVP) by recommending people to use it on the Molec Project (https://sites.google.com/site/psmoleculine/)... it's very simple, the same "philosophy" as the Molec...

Thanks,
Valter

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Add small cpu for R/C servo controlled

Sun Sep 08, 2013 4:11 pm

Hi Valter,

Thank's to your reply.

Yes it is possible, you will need to figure out a way to get the data signal bi-directional, or you may forget the verification pass.

In a rs-232 adapter , only 3 outputs are available DTR, DSR and TX (if you use it with mark/space).

Too bad that the LPT port is obsolete.

To simplify the system, The MCLR could be held manually using a switch.


Daniel

User avatar
ValterFukuoka
Posts: 101
Joined: Sat Oct 01, 2011 11:39 pm
Location: Japan

Re: Add small cpu for R/C servo controlled

Mon Sep 09, 2013 10:43 am

[About burnLVP.py]

Hi Daniel, I am trying on others MCUs and getting the following...

12F1822
16F1825
16F1829
16F1939

They all pass the programming and verification programming...
I tested it using a sample .hex and it works...

[Question is]
For all the above, the BULK_ERASE function is not working!!!
I reset all the parts with a Pickit2 programmer and run the burnLVP on them...

Did you tested the burnLVP with any other MCU besides 12F1840 (which is working perfectly)?

Any idea what is the portion of the code that may need change?
Thanks...

scotty101
Posts: 3670
Joined: Fri Jun 08, 2012 6:03 pm

Re: Add small cpu for R/C servo controlled

Mon Sep 09, 2013 11:02 am

This is a great idea, Would an I2C version be possible?
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Add small cpu for R/C servo controlled

Mon Sep 09, 2013 11:17 am

Hi Scotty101,


Yes it is possible. If you check the github from the post above, you will get code for a A/D cpu using the I2C protocol.

Then modifying to code should be easy since you have all the i2c handshake done.


Or use a standard I2C I/O expander.

But I think direct access is so simple that I2C interface complicates everything.

If you want to program, on the fly, a running cpu using i2c, you will find that the program size of those cpus too small to implement the extra code.


Daniel
Last edited by danjperron on Mon Sep 09, 2013 11:26 am, edited 1 time in total.

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Add small cpu for R/C servo controlled

Mon Sep 09, 2013 11:22 am

Hi Valter,


I checked the pic16F1823 and pic16F1827.

Maybe the bulk erase slipped. I did test brand new chip.


If the cpu has the LVP mode disabled, been program before and the flag been cleared, it won't work.

I will investigate if the bulk erase works tonight. Maybe a problem with the 3.3V (I did read somewhere problems with low voltage).

thanks ,

Daniel

User avatar
ValterFukuoka
Posts: 101
Joined: Sat Oct 01, 2011 11:39 pm
Location: Japan

Re: Add small cpu for R/C servo controlled

Mon Sep 09, 2013 11:50 am

Hi Daniel,

you're right!

16F1823
16F1827
16F1828

ARE WORKING OK...
Just tested them...

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Add small cpu for R/C servo controlled

Mon Sep 09, 2013 1:19 pm

Thanks Valter again,

I will need to buy some of pic16f1822.... to test them. It will take a while since I don't need parts right now.

I'm working on my rfid 13.56mhz reader interface since I change my cell phone with a nexus 4 and I just found out that it was able to scan and write my rfid card. Now I'm just writing code to interface my apsx rw-210 with the Rpi.


Could you confirm that the bulk erase doesn't work with the pic12F1822 and the other ones you specify when the LVP config flag is set before programming.

Next thing to check will be the 3.3V . Use a sparkfun voltage converter and try 5V instead.

Daniel

User avatar
ValterFukuoka
Posts: 101
Joined: Sat Oct 01, 2011 11:39 pm
Location: Japan

Re: Add small cpu for R/C servo controlled

Mon Sep 09, 2013 4:24 pm

Hi Daniel.
danjperron wrote:Thanks Valter again,
Could you confirm that the bulk erase doesn't work with the pic12F1822 and the other ones you specify when the LVP config flag is set before programming.
Daniel
Yes, CONFIRMED, it do not work on 12F1822 and 16F1825 and 16F1829...
Still working on the 12F1840...
danjperron wrote:Thanks Valter again,
Next thing to check will be the 3.3V . Use a sparkfun voltage converter and try 5V instead.
Daniel
I will run some tests using a MOSFET (2N7000) as bidirectional 3v3 to 5v and will report the results here...

Valter

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Add small cpu for R/C servo controlled

Mon Sep 09, 2013 5:18 pm

I found it!

there is a silicon errata from microchip
http://www.microchip.com/wwwproducts/De ... umentation

Bulk erase not available in VLP on silicon revision A6.

I will need to use row erase instead of bulk erase on any A6 revision.

Daniel

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Add small cpu for R/C servo controlled

Mon Sep 09, 2013 6:25 pm

Hi Valter,

could you confirm that the pic12F1822 is revision A6?

This is a problem for people with old PIC cpu. The row erase doesn't touch the config and if everything is lock, you are out of luck.

Daniel

User avatar
ValterFukuoka
Posts: 101
Joined: Sat Oct 01, 2011 11:39 pm
Location: Japan

Re: Add small cpu for R/C servo controlled

Tue Sep 10, 2013 2:58 am

Hi Daniel.
danjperron wrote:Hi Valter,
could you confirm that the pic12F1822 is revision A6?
This is a problem for people with old PIC cpu. The row erase doesn't touch the config and if everything is lock, you are out of luck.
Daniel
YES, the 1822 is Rev06... YES for the 16F1825 too, Rev00 (affected)...

I also did test with a bidirectional level converter (as the picture)...
Image
I'm getting 4.75v at the PIC side...
It confirm the "errata"... DON'T WORK on the 1822/1825...

Still, working PERFECTLY (w/ level converter) for the 1840...

Valter

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Add small cpu for R/C servo controlled

Tue Sep 10, 2013 3:10 am

Hi Valter,

I did check my pic16F1823 and it is revision 8. This is why I never find that problem.

Even if I buy the pic12f1822 , they will work since they will be revision 8.

At least we know why and it shouldn't be a problem on brand new i.c.


Daniel

User avatar
ValterFukuoka
Posts: 101
Joined: Sat Oct 01, 2011 11:39 pm
Location: Japan

Re: Add small cpu for R/C servo controlled

Tue Sep 10, 2013 3:51 am

danjperron wrote:Hi Valter,
I did check my pic16F1823 and it is revision 8. This is why I never find that problem.
Even if I buy the pic12f1822 , they will work since they will be revision 8.
At least we know why and it shouldn't be a problem on brand new i.c.
Daniel
Yes, CONFIRMED. I have more 1822 parts with Rev 8 here... tested, works (right now I am using the level converter)!

Image
Photo shows the "1045" Rev 6 and the "1151" Rev 8...

Valter

User avatar
ValterFukuoka
Posts: 101
Joined: Sat Oct 01, 2011 11:39 pm
Location: Japan

Re: Add small cpu for R/C servo controlled

Wed Sep 11, 2013 5:51 pm

Hi Daniel.

burnLVP can do burnHVP (high voltage programming) also... I just tested with success the:

12F1822
12F1840
16F1823
16F1825
16F1829

... and, considering that the:
16F1827
also works...
... then, I think it is fair to say that the whole family works without problem (in HVP)...

I am testing around this scheme here...
Image
Maybe it can be a lot simpler than that... still testing...

For power supply I am using this one:
Image
It uses the Raspberry 5Volts GPIO pin...

Changes...
1) Commented out all the call to the "magical sequence" (LVP sequence)...
2) Add "Set_HVP()" and "Release_HVP()"
3) Testing a modified "bulk erase" as follow:

Code: Select all

def Pic12F1822_BulkErase():
   Release_HVP()
   sleep(0.1)
   Set_HVP()
   ###SendMagic()   
     
   print "Bulk Erase Program",
   SendCommand(C_LOAD_CONFIG) 
   LoadWordPlus(0x3FFF)     
   SendCommand(C_BULK_ERASE_PROGRAM)
   sleep(0.1)   
   
   print ", Data.",
   SendCommand(C_BULK_ERASE_DATA)
   sleep(0.1)
   print ".... done."
 
   Release_HVP()
   sleep(0.1)
   Set_HVP()
   ###SendMagic()
I will finish more tests and send you the modifications, as well as creating a page with all the information about the hardware and its parts...

Valter

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Add small cpu for R/C servo controlled

Wed Sep 11, 2013 6:24 pm

Hi Valter,


Yes i knew about it . This is why you have some functions like setVPP in my code. I did start with high voltage in mind but using only 5 wires was hard to resist.

Well this little program to burn a small 8 pins cpu for R/C servo start to be a little more than it was intent for.

thanks again,

I don't know how many people use my small code but it will increase the universality of it.

Daniel

User avatar
ValterFukuoka
Posts: 101
Joined: Sat Oct 01, 2011 11:39 pm
Location: Japan

Re: Add small cpu for R/C servo controlled

Thu Sep 12, 2013 6:40 am

Hi Daniel.

First I want to say that I share with you the following "thinking"...
danjperron wrote:...You can't be sure that the RPi will be always in time. Adding real time driver into the kernel is also time consuming...
Then why not using an other cpu to do the stuff! I know you could use the Pollolu serial servo but it is for one part maybe to rigid. So I decide to use a very small cpu , the Microchip pic12F1840...
Daniel
{Co-uController}
Not only for real time stuff, I believe that the idea for co-processor and co-mcu is a natural way to deal with daily stuff...

We can think of the "THINKING BRAIN" as the RasPI and others specific and small "intelligence" need around it as "CO-MCU" (co-processors)... look at the new iPhone for instance, it now comes with a M7 co-processor, because the main "BRAIN" is not the best brain for dedicated tasks...

I started the Molec Project exactly with this kind of thinking in mind... expressed on the diagram below:
Image

(The Molec info site: https://sites.google.com/site/softwarephysical/)

I am also happy to see that your "thinking" using the 12F1840, because it shows that, in the end, for practical reasons, others people are going to arrive "more or less" at the same "place" where we both arrived (I also choose the 1840 and 1825 as starting point)...

Apple called its "M7" as the Motion (co)Processor, and if you like it, you can associate "motion" with "servos" and can "conclude" that the thinking is the same... (as yours servo stuff)
Last edited by ValterFukuoka on Thu Sep 12, 2013 6:45 am, edited 1 time in total.

User avatar
ValterFukuoka
Posts: 101
Joined: Sat Oct 01, 2011 11:39 pm
Location: Japan

Re: Add small cpu for R/C servo controlled

Thu Sep 12, 2013 6:42 am

The scheme for the voltage converter above is this one:

Image

It uses GPIO 5V as input and you can "select output convertion" by choosing different values for R1 and R2...

Return to “Automation, sensing and robotics”