SSC32 and I2C

Hello

This is my first post, I’m happy to join this active community of SSC-32 users :slight_smile:
I am wondering if there is any way to use sensors that communicates through I²C on SSC32? In my case it would be a digital compass such as devantech CMPS03. If I understood well the electronic diagram from SSC32 user guide, I²C is used for communicating with the optional EEPROM, so the SCL and SDA pins from the atmega are connected to the EEPROM extension socket. Any hint on how to get I²C values (e.g. compass direction) through the SSC32?

Thanks in advance!
Hadrien

The SSC-32 is a servo controller, and the best darn servo controller you can get at any price. :slight_smile: The SSC-32 is controlled via an RS-232 or TTL level serial port only,

However, while it talks to the EEPROM using I2C, it will not talk to any off board I2C devices. The I2C bus is used only internally on the SSC-32 and is not intended to interface to external I2C devices. There would have to be code added to the SSC-32 to allow this. I’m sure it could be done, but there would definitely have to be code added to accomodate external I2C devices, new SSC-32 commands added to allow basic I2C communication with the devices, etc. It’s an interesting idea though.

Personally, I’d rather just have the SSC-32 remain the best darn servo controller, at any price. :slight_smile:

8-Dale

Hi Hadrien,

I’ve been thinking about this. I’m already using I2C on a PIC 'bot controller, and it would make it easier if I could add an SSC-32 via I2C.

I’m wondering how the I2C works on the '168 chip.

Of course, I2C needs to run with a protocol, not as simple as just sending chars back an forth through a serial channel. I’ve been talking to SRF08 rangers and the CMPS03 Compass. These have a simple format of sending a byte or two, and getting several back. I suppose the next thing I need to do is write a generalized string send/receive.

There are probably some demos on I2C for the '168. Actually, there are ALREADY I2C routines in the SSC-32 as you’ve noted!

Makes one think!

I wonder if an I2C version be welcome?

Alan KM6VV

You could certainly re-write the serial routines of the ssc-32 to use an I2C type interface. I want to say the Atmel app note is 314 or 315, there are a couple of them addressing use as a slave or master device. The UART module is reading in the commands and parsing them. You could use a sequential write to the SSC-32 to stream a string of random length to it. The Atmel hardware is capable of clock stretching so you would not have to worry about overrun, although it might be a good idea to implement time-outs on both ends anyway.

I would caution you though about using the TWI (Atmel’s name for I2C) module in a multi-master environment… it likes to hang itself. So if you try to use the TWI port as a slave device and still allow it to go out and read the eeprom data on the same bus then you want to make certain you have code in place to detect the hung-up condition. :wink:

I’ll have to take a look at the app notes. In the small PICs, at least, you can’t run I2C and SPI at the same time. Is that true for the '168?

A slave device would probably be sufficient. I’d stick with only a single master.

Writing out a message to the SSC32 shouldn’t be hard. I’d have to look over the return data to see what would need to be done there. I think in I2C you request each byte from the slave, until you tell it no more.

Thanks for the comments.

Alan KM6VV

The SPI and TWI (I2C) modules are separate in the Atmel ATmega controllers.

For many I2C devices the access is much like accessing an eeprom… it allows you to write a command code and/or address followed by writing or reading any number of bytes, the master determines when to stop the transfer by allowing the slave to ack the last byte of the group. of course this isn’t going to apply to every conceivable device out there but the concept is common enough that it could apply easily to the way one controls an ssc-32.

That sounds very much like the interfacing I did on the PIC to talk to the SRF08 and the compass modules I have.

Having the SPI and TWI separate would certainly make things easier.

You’re right, I think a device like the SSC32 could be treated in much the same way.

I’ve also wanted to expand my PIC code to talk to a second PIC slave board. Probably similar as well! Maybe I’ll try that first.

Alan KM6VV

This sounds like a job for SSC-NG (Next Generation). I remember that there were pictures of a prototype board back in January…

I believe that MikeD did bring out the I2C signals to a couple of pins and I believe he was planning to write the code using winavr, such that others could easily compile it…

A 2nd compiler option would be nice, but as I’ve already invested in the present one…

Do we know when it will be ready?

Alan KM6VV

Mike does this work on the side. Like many robotics enthusiasts, his summer months are full of yard work, home fix ups, vacations, outdoor activities, etc. He’s going to have more time to finish it up in the fall. Sorry for the delays, but it will be worth the wait.

Fortunately the only investment required for the 2nd one will be the 5 minutes to download the two parts and do the install. :wink:

I’ve not used it, I’ll have to check it out.

Alan KM6VV

Certainly no complaints on the development of the SSC-32. I seem to be getting little done on my robotics projects as well!

I’m sure it’ll be worth the wait!

Alan KM6VV

The version I use is called Winavr. You can download from:winavr.sourceforge.net/

Kurt

The portable WinAVR sounded interesting, but the link was broken.

Thanks for the URL.

Alan KM6VV

Edit:

found it!

chip45.com/index.pl?page=Portable_WinAVR&lang=en

Once you have the WinAVR toolset installed go get AVR Studio 4 and install it for a full IDE shell that includes debugger support for their various programmers and a simulator too. It should find the WinAVR suite when it installs and set up the necessary paths accordingly. 8)

I downloaded and unpacked the portable WinAVR to a USB memory stick, but couldn’t get it to do anything. Have you played with it?

Alan KM6VV

Yes I use it at home through AVR Studio 4, although it is just all loaded on the hdd. We also use it at work on projects where customers did not want to be locked to buying an IAR or Keil license to support their product down the road. Mostly at work I use IAR for Atmel controllers though because if I have a problem or question with how to make it do something specific we have a support contract. :unamused:

The short answer is yes. Yesterday I updated mine to the latest version, by downloading WinAVR-20080610-install.exe. I then ran the program and asked questions where I would like it, which I choose c:\winavr as to overwrite my previous installs. Once the install completes, I run the program “Programmer’s Notepad”, whic hI think there should be a link on your desktop. (If not, it should also create a directory in your start menu, which has program items for this as well as users manual and the like). Using the Programmer’s Notepad you can create or open projects and run the compiler and the like. Or as EddieB stated you can then install Avr Studio 4 and it should find your install and under it’s projects you can again use the build menu to build your program or the like.

You can also configure it to do the downloads to your board. In my more recent uses I used an jtagice MKII to download programs to a BDMicro Maveric 1B board (Atmega128). On other boards I used a serial connection to download. The nice part about using the JTAGICE is then you can run the debugger…

Ha, I use the JTAGICE MKII at work but it is way to expensive for me to justify at home. The ATAVRDRAGON is nice and capable and does both JTAG and ISP however it is somewhat fragile, almost frail, so you have to be very careful and methodical about how you connect and power things or it goes away, frequently with no real indication other than it doesn’t program the parts any more. :unamused: