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

Re: Add small cpu for R/C servo controlled

Thu Sep 19, 2013 10:59 am

(RasPI 3.3Volts)

Just to be sure that the GPIO 3.3Volts are fine, I did test on the 18F4550 (40pins DIP) also...

All these MCUs:
a) 18F14K50
b) 18F2550
c) 18F4550

Are doing:
1) device id OK
2) read OK
3) bulk erase OK
4) write (little test) OK

The 18F4550 uses exactly the same code as the 18F2550, since the PROGRAM SPECS are the same.
According to Microchip datasheet:

Code: Select all

• PIC18F2221 • PIC18F2580 • PIC18F4480
• PIC18F2321 • PIC18F2585 • PIC18F4510
• PIC18F2410 • PIC18F2610 • PIC18F4515
• PIC18F2420 • PIC18F2620 • PIC18F4520
• PIC18F2423 • PIC18F2680 • PIC18F4523
• PIC18F2450 • PIC18F2682 • PIC18F4525
• PIC18F2455 • PIC18F2685 • PIC18F4550
• PIC18F2458 • PIC18F4221 • PIC18F4553
• PIC18F2480 • PIC18F4321 • PIC18F4580
• PIC18F2510 • PIC18F4410 • PIC18F4585
• PIC18F2515 • PIC18F4420 • PIC18F4610
• PIC18F2520 • PIC18F4423 • PIC18F4620
• PIC18F2523 • PIC18F4450 • PIC18F4680
• PIC18F2525 • PIC18F4455 • PIC18F4682
• PIC18F2550 • PIC18F4458 • PIC18F4685
• PIC18F2553
they are should work... with RasPI GPIO 3.3Volts and LVP stuff...
Valter

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

Re: Add small cpu for R/C servo controlled

Thu Sep 19, 2013 12:53 pm

About PIC MCU information...

Hi, for Daniel, or anyone that may want to try, I've extract some MCU information from the source code of PicProg... then I created one spreadsheet on Google Docs...

Stuff like, device id, program memory size, eeprom size, row size...

https://docs.google.com/spreadsheet/ccc ... sp=sharing

Anyone with the link can view/copy, and Daniel can edit/copy...
If you want, just make a copy for yourself, then the copy will be read/write and the ownership of the document will be yours...

Valter

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

Re: Add small cpu for R/C servo controlled

Thu Sep 19, 2013 2:21 pm

Thanks Valter,

I will ckeckit after work.

Great work ! I wont have to check the xxxx and the xxkxx series.

I'm impressed that you can understand my giberish code so quickly.

I will check on Github how to give you access.



Daniel

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

Re: Add small cpu for R/C servo controlled

Fri Sep 20, 2013 3:56 am

I complete the code for the pic18F258 cpu

Config, EEPROM and ID programming are working. (Didn't check the config but should work).

P.S. I use a mask to verify the configs . Also force LVP enable.

I added some generic functions for other pic18 famillies implementation.

the github is updated.

Next will be the other cpus implementation and create the table of parameters for each one.


Good night (really need to sleep).

Daniel

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

Re: Add small cpu for R/C servo controlled

Fri Sep 20, 2013 6:27 am

danjperron wrote:I complete the code for the pic18F258 cpu
Daniel
Nice job, you're really fast at coding...

I am looking at the code now, don't have any 18Fxxx mcu, just looking at the code and the datasheet...
As you said, "it is a different kind of animal", a departure from the 12F/16F of the original burnLVP...

[18Fxx50 and xxK50]
Having done some "research" on the 2550/4550/14K50, I believe I can help with them...
Right now I am checking datasheets to know the differences between them and the 258... after that I will try to test the code with them...

Valter

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

Re: Add small cpu for R/C servo controlled

Fri Sep 20, 2013 7:13 am

Daniel, making burnLVP work with 18F is interesting feature, at least in my point of view…

I told (here) that I am working on making burnLVP work with a normal desktop PC and an USB to Serial Adapter… so, let me tell you in 3.000 words (only) the reason I am quite excited about it, plus ultra, now it can program 18F series in LVP mode…

Well, I did not start with conventional USB to Serial Adapter, but, I am building a new kind of USB Burner that uses only 1 CHIP!
Already tested it with C and Python, besides being just a prototype today, I KNOW it works!

This is the name I have for it: MICRO PIC BURNER, and… IT’S ALIVE!
With your new code, it can burn itself to a new CHIP because I am using the PIC18F14K50 as prototype test (should work with 2550/4550 with few minimalist changes)… so, it can REPLICATE, it is ALIVE!

If 1 picture worth a 1.000 words, then this is my 3.000 for today…
(right mouse click to see the full size image)
{The MicroPICBurner Proto and 12F1840}
Image

{The MicroPICBurner Scheme}
Image

{The diagram showing the “it is alive”}
Image

Well… need some more work to become a full reality…
After looking the simplicity of the burnLVP code, I realize that making it work directly on the PC using a simple USB adapter would be a nice idea… and by coincidence (?) I was doing something with the 18F14K50 and USB2Serial stuff…
Congratulations Daniel, you are accomplishing several steps by doing just one more…

Regards all,
Valter

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

Re: Add small cpu for R/C servo controlled

Fri Sep 20, 2013 11:28 am

This is a nice project Valter,

very good and simple.

P.S. You could reduce the number of parts even more since this cpu has a build-in oscillator. You could remove the resonator. Maybe it won't be stable enough but I think it should be ok.

Also once we have something working with a few other cpus. I should revise the code and use virtualization in python.

I should create a class for pin configuration (Raspberry Pi , parallel port, usb, etc..)
I also create class for each pic cpu. Always better to read code with one function call BulkErase
instead of many (BulkErasePic12,…Pic18FXXX,… Pic1825580,… etc).



Daniel

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

Re: Add small cpu for R/C servo controlled

Fri Sep 20, 2013 1:06 pm

danjperron wrote:This is a nice project Valter,
very good and simple.
Daniel
Daniel, to be honest with you, in the very moment I was translating the code from "burnLV RasPI Python" to "PC Python", in the text (for example):
GPIO.output(pin, value) to PCIO_output(pin, value)
I realize that the simplicity of the mechanism plus the comprehensibility of Python can do a LOT more than "burn bits" inside a MCU...

Then, the MicroPICBurner itself is "just" one (the instance) of such possibilities...
The real general stuff here (the class) is the USB Micro PC I/O... (the GPIO for PCs)

Image

I think that the basic reasoning here is the simplicity of the mechanism, high level control by Python and the cost of the apparatus...
BUT, of course, this is an entire new possibility, which I think will be good to follow after making the burnLVP PC stable...

Valter

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

Re: Add small cpu for R/C servo controlled

Sun Sep 22, 2013 12:00 pm

Daniel, 2 weeks past since I decide to test "Burning Low Voltage Programming", and, as a result, for me now, it's Mind-Blowing!!!

For the stuff I was doing with my little Molec Project, this "small PIC programmer" can burn PICs and Blow Mind...

I think this is more stuff than a "weekend" project...

Now I am sure it will be playing an important role on the Molec Project...

Testing a lot of stuff around it, using C, C and C, and Python (lol) it is easy to see that the decision to make it in Python was pivotal to achieve the final "simplicity"... and also the importance to have a INTERPRETED environment to play with physical software became clear for me in these few days...
I was using PI and Python for other stuff, but for the first time I did have a chance to DIRECT COMPARING between C and Python (for physical computing stuff)... it's an "open eye" experience for me... there is also the issue of portability...

Anyway, don't want to create a dossier, just want to say, COOL, VERY NICE PROJECT.
If you look at this diagram, you can "see" the "why" I am excited about it...
Image
"Do one thing", "Do it well"...

burnLVP can be "THE" programmer (burner) for the Molec Project... because it uses the very basic "philosophy" of the Molecs... PERFORM SMALL TASK, VERY SIMPLE AND VERY WELL...

Let me abandon the post here, because the mind really "blow" for while...
Regards,
Valter

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

Re: Add small cpu for R/C servo controlled

Sun Sep 22, 2013 12:44 pm

Hi Valter,

I'm working right now at virtualizing burnLVP,

I doing class and interface. This way you could just specify which device I/O you are using
(more or less rem out the import to specify RasberryPi GPIO, Serial com or parallel port, even
Labjack adapter if you want).

I already put the pic12 into a class and I will do it for the Pic16F….. .

For the Pic16F… there will be more than one class since we don't use exactly the same methods all the time. So a master class with an overlay of specific pic16F.. family class.

This way it will be easier to adapt the burnLVP to any cpu / device to program. Even the Atmel cpu family could be added ( some are serial and some use jtag). Also in a long run the PIC32 could be easily included.

The only draw back is that it will be more than one file. But in my point of view it will be easier to debug since each file will contain small information.


Once The Master class for the Pic16F… and got at least two pic16F... family complete , I will post the code.

Daniel

veteranz_guian25
Posts: 14
Joined: Mon Sep 23, 2013 3:38 pm

Re: Add small cpu for R/C servo controlled

Mon Sep 23, 2013 4:11 pm

is it possible to control the servo motors one at a time?

example i want to make a robot arm that can be controlled via android phone?
has the control function to move left, right, up and down??
can u help me?

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

Re: Add small cpu for R/C servo controlled

Mon Sep 23, 2013 6:19 pm

Hi veteranz_guian25,

I don't understand your question since you control the servo one at a time.

If you mean sending in one command all servos informations. You don't need it ! The speed of the communication is so fast to be an issue.

Daniel

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

Re: Add small cpu for R/C servo controlled

Mon Sep 23, 2013 10:43 pm

Hi veteranz_guian25,

I know that you want to control servo via the android phone.

just check that post
http://www.raspberrypi.org/phpBB3/viewt ... 95#p395195

You will have a link to my post in french and a link to the creator of a webiopi using an android phone to control is r/c car

If you open my webiopi webpage , you will see code to control r/c servo. On that car it was a pololu serial servo but it could be my small cpu servo. Just change the function.

Daniel
Last edited by danjperron on Wed Sep 25, 2013 2:39 am, edited 2 times in total.

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

Re: Add small cpu for R/C servo controlled

Tue Sep 24, 2013 4:43 am

Hi all.
I am creating a kind of "article" about physical software... its very very basic stuff, intended for people that are starting now on the subject...

This one will be using burnLVP.py and will be around the notion of a MCU, what is its purpose and how to create a little program on it (the traditional blink LED)...

Here is the site: https://sites.google.com/site/makeringbit/burnlvp

Still missing 2 small videos and some photos, but the overall idea is there...

I'm thinking another separated one for the "burnLVP 18F", and also another possible one dealing with the "burnHighVoltage" (which uses a hardware interface)...

Also thinking about a single "infographic" about (pointing to) this page, to serve as "intro" to the page itself...

Regards,
Valter

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

Re: Add small cpu for R/C servo controlled

Tue Sep 24, 2013 11:13 am

Hi Valter,
really nice!

You are way better than me on documentation.

I can't work on the burn18.py this week but I will continue next week.

Maybe the next tutorial should be about serial TTL and later about I2c. Just an idea.

Daniel

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

Re: Add small cpu for R/C servo controlled

Wed Sep 25, 2013 12:28 pm

burnLVP
Working on entire family, ALL revisions (including the ones with SiliconErrata)...

- 12F1822
- 12F1840
- 16F1823
- 16F1825
- 16F1827
- 16F1828
- 16F1829

.Read
.Write
.Erase

Now it works with the entire family 12F/16F18xx, new revisions chips and OLD revisions chips.

All tested, all pass.

The Erase operation now is "row erase", it takes a little longer than the "bulk erase", but since bulk erase is not working on old revisions MCU there is a new "row erase"...
It is possible for the program itself to SELECT between "bulk" and "row" according to information from SiliconErrata Datasheet, so the MCUs that don't have the problem will perform faster than (bulk erase) the others that have the SiliconErrata (row erase is these cases)...

Anyway, the code is temporarily here:
https://dl.dropboxusercontent.com/u/296 ... ta-v1.5.py

When finally done, it will be on the repository...
If you test and find any problems, please report.

Valter

veteranz_guian25
Posts: 14
Joined: Mon Sep 23, 2013 3:38 pm

Re: Add small cpu for R/C servo controlled

Wed Sep 25, 2013 4:45 pm

Hi Danjperron,
what i am trying to make is a controller for the movement of a robot arm, based in this project..
http://www.youtube.com/watch?v=QCsiBLz6qqo

got the parts, but the controls are all made by the potentiometers i think, i am trying to enhance the project by making the controls done by an android phone..

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

Re: Add small cpu for R/C servo controlled

Wed Sep 25, 2013 6:00 pm

Hi veteranz_guian25,

I saw the post. I don't see any problem to implement it. You will need 4 servos . My small cpu has a resolution of 10 microseconds if you need more precision you will have to use polulu serial since they are base , I think on atmel i.c. which has build in PWM. But you should be able to create a web page which will transfer the info to the Rpi.

For android perspective you are talking at the wrong guy. I did some basic stuff but I'm presently dum to do any programming on Android and Iphone.

But to have the android respond to a web page , it should be easy. there is some javascript virtual joystick example available.

Maybe the first thing will be to create buttons , up, down, up, center, etc.. And when everything is ok , modify the code for virtual joystick or accelerometer.

On the french post , previous post, you have the html code with javascript to control the camera on my robot. This is exactly what you need to do first.
p.s. My robot use pololu serial servo. The protocol is different but it is easy to change since on this current post , first page , you do have the code for the pic12f1840.

You have all what you need. Start small, one servo with basic python. Add one servo at the time. Create the webpage with buttons and finally use some javascript virtual joystick.

Also you could use the Rpi directly for the pwm . servoblaster, wiringpi, etc..

Daniel

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

Re: Add small cpu for R/C servo controlled

Wed Sep 25, 2013 7:20 pm

If you actually want PWM you are better off using http://abyz.co.uk/rpi/pigpio/cif.html#gpioPWM

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

Re: Add small cpu for R/C servo controlled

Wed Sep 25, 2013 8:14 pm

And of course pigpio.

Sorry Joan It slipped my mind.


I did use it and it is working well.


Daniel

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

Re: Add small cpu for R/C servo controlled

Thu Sep 26, 2013 7:52 am

ValterFukuoka wrote: PC USB-TO-SERIAL INTERFACE!!!
See the time it takes to program (a blink led)?
Mon, 16 Sep 2013 08:45:19 +0000
... (programming...)
Mon, 16 Sep 2013 08:52:19 +0000

...taking a LONG time...
Valter
Hi all, I think I am near the announcement of the PC USB version...
I did some optimization on the host side and on the firmware side...

Now it is taking 8 seconds to program the "blink LED" sample...

Code: Select all

C:\Python27\pyusb-master>python pythonLVP-v0.3.0.py 12f1840_blink.hex
Thu, 26 Sep 2013 07:22:51 +0000
File " 12f1840_blink.hex " loaded
MCU : 0x1b80  : PIC12F1840 Revision  0x4
ProgramSize = 0x1000
DataSize    = 0x100
Bulk Erase Program , Data. .... done.
Writing Program................................Done.
Writing Config..Done.
Thu, 26 Sep 2013 07:22:59 +0000

C:\Python27\pyusb-master>
Image

Well, need to put back the checking routines (blank, program, data, config), then it will be around 20 seconds, I think...
I don't want to seek further gain in speed without testing it on different MCUs... so I believe the current level will be the one for the "version 1.0"...
Also need to run a whole range of tests on Linux...

Valter

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

Re: Add small cpu for R/C servo controlled

Fri Sep 27, 2013 12:33 pm

About PIC18F2550...

Success, using RasPI GPIO, wires only and burnLVP18F.py...

Just want to announce (for 2550):
a) programming memory OK
b) programming config OK
c) reading memory OK
d) reading config OK
e) reading device ID OK
f) bulk erase OK

Need to work on the remaining routines (UserIDs, EEPROM)...
Just did a "blink LED" with success...


18F14K50... "almost there"...
For the 14K50, EVERYTHING THAT WORKS ON 2550 IS WORKING, except...
Configuration Bits Programming... is NOT WORKING...
Anything I tried to put there, even only one byte, makes all the MCU "code protected"... requiring a High Voltage Programming Bulk Erase...

Looking at the datasheets I could NOT find any difference other than one word of sequence (0x84A6) required by the 14K50 that is not required for the 2550...

Did ask Microchip forum for any infos concerning it:
http://www.microchip.com/forums/tm.aspx ... e&m=747960

Since everthing else is working, I think 3.3Volts is NOT a problem... and since the algorithm for CONFIG is the same for PROGRAM MEMORY, there should be NO problem on the algorithm also...

Will be trying 5Volts to try to come to a solution...

If anybody has any info about it (18F14K50 and Config Bits LVP Programming), please let me know...

Thanks all,
Valter

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

Re: Add small cpu for R/C servo controlled

Fri Sep 27, 2013 4:23 pm

ValterFukuoka wrote: Success, using RasPI GPIO, wires only and burnLVP18F.py...

Just want to announce (for 2550):
a) programming memory OK
b) programming config OK
c) reading memory OK
d) reading config OK
e) reading device ID OK
f) bulk erase OK

18F14K50... "almost there"...
For the 14K50, EVERYTHING THAT WORKS ON 2550 IS WORKING, except...
Configuration Bits Programming... is NOT WORKING...
Anything I tried to put there, even only one byte, makes all the MCU "code protected"... requiring a High Voltage Programming Bulk Erase...

Valter
YES, just want to report that even at 5 VOLTS, the 18F14K50 DON'T WORK FOR CONFIG WRITE!

I just confirm that the 18F2550 also works without any problem at 5 Volts...
Also, using the old turtle-speed routines inside the firmware, I am able to program the 18F2550 using MICRO PIC BURNER...
Image
So, the MicroPICBurner (based on 14K50) can program its brother 2550, but is currently UNABLE to self reproduction...

Still need to test C code for the 14K50 Config burn (only trying Python until now)... but don't know if this strategy will work...

Valter

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

Re: Add small cpu for R/C servo controlled

Fri Sep 27, 2013 11:29 pm

ValterFukuoka wrote: YES, just want to report that even at 5 VOLTS, the 18F14K50 DON'T WORK FOR CONFIG WRITE!
Valter
Found the problem... now the MicroPICBurner (18F14K50) can reproduce itself...
Problem was in the timing of the closing sequence of the CONFIG WRITE... need a little bit more of time than the PROGRAM WRITE...

Tested on RasPI burnVLP-18F and PC burnVLP-18F (turtle mode)... lol...
Still using the turtle-mode firmware for tests (on the PC version)...

Image

Thanks all,
Valter

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

Re: Add small cpu for R/C servo controlled

Sat Sep 28, 2013 11:18 am

burnLVP_18FXX(K)XX RasPI GPIO beta version

The code for 18F2550 and 18F14K50 still incomplete (and messy), but it can:
Using RaspberryPI GPIO and Python:

a) bulk erase
b) program memory
c) program config bits

tested on:
1) 18F2550
2) 18F14K50

Temporarily here (PLEASE READ RED TEXT BELOW):
https://dl.dropboxusercontent.com/u/296 ... a-0.3.2.py

Final, stable version will be here:
https://github.com/danjperron/burnLVP

Remember that you need the PGM wire:
Image

ADVICE:
DON'T TRY TO RUN THIS CODE IF YOU ARE NOT SURE ABOUT WHAT YOU ARE DOING.
I PUT THIS CODE HERE JUST IN THE CASE YOU ARE ALSO TESTING AROUND THE SUBJECT AND WANT TO HAVE A LOOK AT THE SOURCE LEVEL...
PLEASE, WAIT FOR THE STABLE FINAL VERSION.

IF YOU BURN INCORRECT VALUES TO YOUR PIC18 CONFIG ZONE, YOU WILL BE UNABLE TO RECOVER IT USING LOW VOLTAGE PROGRAMMING...


Valter

Return to “Automation, sensing and robotics”