New Controller Board

That is correct! I have a name :slight_smile: I am not an ASCII 0x3F character!

This thread has been very active. I’ve skipped a number of posts because i’ve been lazy this weekend.

But, wouldn’t an octopod technically not need too much more torque since there are two more legs to help spread the load? Of course if its balancing all the weight on 4 legs it would need a lot of torque. Especially if the other legs are high in the air. How would an octopod even walk?

Yes, the MCP23017 has to be configured. It can be used as two 8 bit ports or a single 16 bit port. The data is also written to and read from registers on the device.

We are starting to go way off topic here, and I’d like this to stay on the topic of the new dual PIC board we are designing. :smiley::smiley:

We can start other threads if we want to talk about octapods. These also interest me a lot since I want to build one someday.

8-Dale

Hi Jim,

Yeah, I know you’re pretty busy, and don’t really have time to participate in all of the threads. But I thought you might be secretly working on an octapod! New product!

Actually, I hadn’t thought about the change in gaits needed other then the obvious need to move eight legs instead of 6. That part is relatively easy.

I’m glad you brought it up! I can see why; more legs needed down to carry the weight. But it would be 4 vs 3 legs, or 133%, and I suspect the total weight of the 'bot would only go up 125% (guessing)? Plenty of time to figure it all out, I don’t have all my legs yet!

Pentapedal gaits? 4 -2 gaits? Do you have any references? I’d just started to investigate last Friday.

kimura.is.uec.ac.jp/facultie … obots.html

Best regards,

Alan KM6VV

SO WHAT IS IT?

:laughing:
old school politeness meets l33t h@x0r n@/v\3z generation.
:unamused:

OK, I think I am starting to understand Pete’s I2C code now. It looks like he sends the register address as the first byte of data after sending the device address. I got a little help in understanding this from Barry (ginge) over on the Open Servo forums. However, my problem now may be that Pete’s code does not like running slower than 10 Mhz, and the math for 8 MHz does not work out exact.

I may have to wait until I get my 20 Mhz crystals to work with this more, so I can start out with 10 Mhz.

8-Dale

On this note I saw something go by earlier about the crystal on the UBW being only 4MHz… it depends on which incarnation you have. The SMT one from sparkfun (SKU#: DEV-00762) has a 20MHz ceramic resonator (noted on the UBW homepage when you select the specifi bootloader.hex file for your version.)

Hi Dale,

If you have a 8 MHz XTAL and want to use it; then you may be able to just change the PLL multiplier, or a timer re-load. What is it exactly that’s not working? A baudrate for I2C? Where’s the math?

Alan KM6VV

Anything having to do with the MCP23017 is not working at all. I can’t tell whether the 4550 is actually sending down the I2C lines or not. The 4550 and 4620 PICs seem fine. I have temporarily switched back to a 4620. My code seems like it should be working, but it is not. Here is my current up to the second code for my i2cleds project. I believe I am doing things right, accoding to how Pete is doing things in his code, but it is not working for me. I still think there might be a problem with the 8 Mhz clock rate, but I am not sure.

8-Dale

Hi Dale,

I just took a look, and second_ticks = 80 looks like it could be changed to correct the timing for your xtal. Might be other things. This is a point where a DIVISOR could be calculated for you in relation to the XTAL frequency. Not important if you’re not going to change the XTAL frequency, but then you should be making this calc at one time or another.

If I don’t think something is working at all, it’s the time I drag out the 'scope (or a logic analyzer). If you don’t have that, then a good logic probe can indicate some activity.

Outta time,

Alan KM6VV

I am using the internal 8 Mhz oscillator right now, because I don’t have any crystals yet. I have several 20 Mhz crystals on order.

I don’t even own a DMM right now, but am hoping to get one next month, if i have the spare cash. I would love to have a logic analyzer, even the lower priced BitScope, but that is even expensive for me.

8-Dale

Hi Dale,

I just saw that you were using the 8MHz internal when I looked at the code. I see now that the '23017 (I2C) runs at fixed baudrates. SPI does not.

Well, it’s not the SECONDS parm, it’s:

SSPADD = 24;        // ~100KHz Clock

That would have to be changed to get it to work on one if the fixed '23017 baudrates. Time to wait for an XTAL.

The '23017 chips can be useful, but having two processors talking (I got my DSPIC30F401230 chips yesterday) would be more useful (to me).

I checked on the '4620, and I2C and SPI SHARE the master SSP. Probably can’t be switching back and forth between setups!

What, not even an old FLUKE 8024 DMM? How about USED test equipment? It can often be had quite cheaply.

Alan KM6VV

Where is this line in the code? If you can point me to a file and line number, it would help. :slight_smile:

They are useful for a project I am working on. :slight_smile: I like them for sequencing LEDs, and I have one Atom project I want to revisit to see if I can get it to work with a PIC now.

It’s not too bad switching between the 4620/4680 and the 4550. I just have to change my pull-ups and I2C lines to different pins.

I was looking at datasheets, and was reading a thread over on Spark Fun about the CAN bus. So, I checked the datasheet for the 4680 which has CAN, I2C, SPI, etc. The CAN pins do not conflict with the I2C/SPI pins. :slight_smile: I also didn’t realize until then that the dsPIC4011 also has CAN, and the I2C and CAN pins do not conflict. The 4680 is pin compatible with the 4620. This is interesting, so I ordered some chips I have never used before - the MCP25055 which is a CAN bus expander. I figured it would be an easy way to experiment with CAN, much like I am doing with I2C and the MCP23017.

In other news, I think I have a power related problem, as in not enough, on my breadboard. I tried setting up to program a dsPIC4011, but I am not able to do it. I can program 18F parts just fine though. I’m going to have to find a nice little low cost 5V/12V power supply so I can power my circuits and have the ICD2 powered from the circuit also.

8-Dale

LINUXGUY!!! I’m sooo sorry >_<;; Alan is TOTALLY right! It was late last night and I couldn’t think straight because of this nasty virus :imp:

In the pic_i2c.c file there is this function:

void setup_i2c(void)
{
    uchar temp;

    SSPCON1bits.SSPEN = 0;          // Disable I2C Mode
    PIE1bits.SSPIE = 0;          // Disable I2C Interrupts
    SSPCON1 = 0x08;     // I2C Master Mode
    SSPSTAT = 0x80;     // SlewRate Control Disabled
    SSPADD = 24;        // ~100KHz Clock
    PIR1bits.SSPIF = 0;          // Clear Interrupt
    SSPCON1bits.SSPEN = 1;          // Enable I2C Mode
    temp = SSPBUF;          // read buffer to clear buffer full
    reset_i2c_bus();
    return;
} // setup_i2c()

The register SSPADD is what controls the speed at which I2C talks at… The equation for it is so:

((CLOCK/BITRATE)/4)-1

Pete has it set for 24, i.e: ((10,000,000/100,000)/4)-1 = 24. You need to set it to 19:

((8 000 000 / 100 000) / 4) - 1 = 19

because you are using an 8MHz internal crystal, not 10MHz like Pete. I totally forgot about that register. Try updating it to 19 and see if it works now.

It wouldn’t work with 24 because you are talking to the MCP at a weird speed and it is just like ā€œwTF?ā€ and ignores it. It can only support 100, 400, and 1Mb I think. It can’t support the weird speed 24 set for you.

SOOO Sorry >_<;;

-robodude666

I made the change, but it didn’t help. :frowning: I know I have some power related problems, as in not enough current, etc. I wonder if this is what is causing I2C not to work - increased current draw as the MCU starts doing more.

8-Dale

Power related? What are you powering everything with? How many LEDs do you have currently?

Hi Dale,

Power shouldn’t change much, you have the code in a continuous loop.

You might do things like turn on a port pin in an interrupt routine, just to see if it gets called. Or if it gets called more the once (10x?).

Does your com port work? Can you send/receive text strings?

Alan KM6VV

I currently have a 4550, a 4620, an MCP23017, and 11 LEDs powered in two separate circuits. The 4550 is driving 9 LEDS and the 4620 circuit is driving 2 LEDS. It’s really no wonder now that I have been having weird problems. Right now everything is powered from the ICD2, since I don’t have a real good way to get power to everything otherwise.

I may try tapping off WALTER’s bot board again. That did seem to work OK before but I didn’t have as much on my breadboard as I have now.

8-Dale

Hi Dale,

Well, that might do it. Get a wall wart and a 5V reg (7805) on there!

Alan KM6VV

I believe I have enough current supply to my breadboard now. I tapped off one of WALTER’s bot board servo connectors. :smiley: I was able to program a dsPIC4011, so that is definitely a good sign. I now have the ICD2 powered from the circuit and all that seems to be working perfectly now. :smiley:

I still have not got I2C working though. :frowning: I am starting to fiddle with some I2C stuff Grasshoppah gave me, so we will see if I can make that work. His code is much smaller, and easier to work with as a first I2C PIC project.

8-Dale