BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 1:11 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: C/C++ Programming accessing EEProm....
PostPosted: Wed Feb 09, 2011 11:57 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
Hi Nathan (and others),

Not sure if posting here or email is the best way to ask this... But I posted as maybe there are a few others such as MinionBuilder who may know the answer and/or may be interested in the answer... :D

As you know I have been playing around with C libraries as well, currently have phoenix (hex code) working on Arc32 with or without SSC-32 (Includes HServo2 type of code). Also have HSERVO(1) type code running on Bap28 and probably Bap40 (have not tested my current version yet). I have a C version of the biped Brat code running using my HSERVO on a Bap28. I am currently trying to get the code working to read the servo offsets from the Bap28's EEPROM. I started off with the code MinionBuilder did for reading EEPROMs which so far worked fine for me on the Arc32, but it appears to now hang on the Bap28. Which I will debug next... But my first look through brought up a couple of questions.

1) On the Bap28 SDA is on P6 (H8->P56) and SCL is on P7(P57). On Bap40 not sure if current one is on H8 P56/P57 or you mentioned in some other thing about ReV D being on P86/P87? So far I am assuming P56/57... Also not doing much with Bap40 so for me this is semi a non-issue.

2) Since P6 and P7 or real IO pins, which can and in my case are used for Servos. How do you handle the dual purpose of these pins? Some of this may be obvious. Things like:

a) ReadDM - When you enter into this command you probably turn on I2C mode(IIC2.ICCR1.BIT.ICE = 1), do your stuff and at the end of the command you probably exit I2C mode (IIC2.ICCR1.BIT.ICE = 0).

b) How do your reads/writes without screwing up HSERVO. That is if you do something like: hservo [p6\0, p7\0]
and then do a readdm...
How to keep the readdm from screwing up the HSERVO pulses?
I may for the fun of it write a program and look at the logic analyzer to see...

Thanks
Kurt


Top
 Profile  
 
 Post subject: Re: C/C++ Programming accessing EEProm....
PostPosted: Wed Feb 09, 2011 5:11 pm 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
More notes to myself...
It appears from the datasheet that Bap28/Bap40 don't use the normal I2C IO lines for SCL/SDA, they use H8 pins 75 and 76... Looks like time to roll my own...

Kurt


Top
 Profile  
 
 Post subject: Re: C/C++ Programming accessing EEProm....
PostPosted: Thu Feb 10, 2011 7:50 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
FYI - I found that MinionBuilder already solved this in his version, so I borrowed the code along with the copyright stuff... So I am now Reading the EEPROM on the Bap28... Have not tested yet on Bap40... Now to work on making the servo offsets work properly...

Thanks again Robert for all of your work here! Someday we probably should merge our stuff...

Kurt


Top
 Profile  
 
 Post subject: Re: C/C++ Programming accessing EEProm....
PostPosted: Thu Feb 10, 2011 11:16 am 
Offline
Master

Joined: Sun Oct 05, 2008 9:40 am
Posts: 111
Quote:
Not sure if posting here or email is the best way to ask this... But I posted as maybe there are a few others such as MinionBuilder who may know the answer and/or may be interested in the answer...


I enjoy the information. I just started with C last week. I am about half way through reading the book "Programming Interactivity". With that being the case I will be coming back to this info soon.


Top
 Profile  
 
 Post subject: Re: C/C++ Programming accessing EEProm....
PostPosted: Wed Feb 23, 2011 4:48 pm 
Offline
Citizen

Joined: Fri Jan 22, 2010 9:00 am
Posts: 12
Yeah that internal EEPROM interface was interesting to work out.
I am using it with the BAP40 and it works fine.

Shout out to Nathan (AcidTech) for having given me the pin numbers in a long-ago post. Thanks for all those posts that are there when the need comes up. When he first mentioned it, I had no idea what he was talking about. After researching the Hitachi docs, it finally made sense. I don't think I would have gotten it from the docs without already having the pins numbers from Nathan. When the pins were referenced in the docs, I said to myself, I know these numbers from somewhere.

I have posted a reply over on the LynxMotion forum about merging our code.
I also updated the main post with the latest C (and Basic) code today.

-Bob


Top
 Profile  
 
 Post subject: Re: C/C++ Programming accessing EEProm....
PostPosted: Wed Feb 23, 2011 6:31 pm 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
Yep I found it after I assumed it was using the hardware I2C and my code hung. I then looked carefully at the Bap28 schematic that is like page 8 of it's datasheet and found, the actual IO pin.

This made sense as I wondered if he used the real I2C how the HSERVO code on those pins was not screwed up when you did a read or write of the EEPROM... I have not worried about the Bap24 in any of my code, but I believe that you can add an external EEPROM, but you need to connect it up to the real SCL/SDA....

Kurt


Top
 Profile  
 
 Post subject: Re: C/C++ Programming accessing EEProm....
PostPosted: Thu Feb 24, 2011 9:18 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
If you want to use an external eeprom on an AtomPro 24 and use the read and write commands to talk to it instead of i2c commands, you need to connect to pins P10 and P11. P10 is SCL and P11 is SDA for the read and write commands on Pro24 modules. The eeprom bus is on internal pins p34 and p35. So you can use i2cin and i2cout with p34 and p35 if you want to, though read and write are just wrappers for i2cin/out commands tied to those specific pins.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


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

All times are UTC - 8 hours [ DST ]


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

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO