1284P and i2c

Just got a Bobweeny from Crossroads, and I am not getting the i2c to function at all. He suggested I add the 4.7k pullups, which I did and did not help. I have an Adafruit RGB shield and a couple other i2c devices. I try running the i2c scanner and I get 0 devices. On an Uno or Mega it works flawlessly, and returns the addresses of each device connected.

I can load the blink sketch and the LED blinks. The i2c scanner communicates with the serial monitor, so I know the comm is working, and the bootloader is taking sketches.

Anyone who has a 1284P and successfully using i2c please help!

Are you using the right pins? I2C is not on the same pins as it is on the '328.

Thanks for the quick response. Mine will be slower due to the "new guy" limitations of 1 post per 10 minute period. I guess that is supposed to reduce spammers?

Anyway,
Yes, I am sure I am using the correct pins, 22 and 23. I have even wired up SDA and SCL backwards just in case my pin map was mislabeled.

On a scope, they just flatline @ 5V (of course because of the pullups)

I have the IDE configured to run at 400k, but that shouldn't be an issue.

Yeah, it's to deal with spam, since we routinely get people posting advertisements for... actually usually just advertisements for male enhancers (my female friends opine that males need many enhancements - but not that kind).

Well, that's strange... I'm not sure why it wouldn't work then... Maybe ask Crossroads? (he doesn't check this section of the forum, I don't think - and i don't blame him - it's mostly the same few problems over and over - and ones that are annoying and boring to help people with too)

I browse all the new posts when I am online. He did check with me last night, I suggested the forum for help. I haven't done any I2C with 1284P yet, not sure why Wire.h library wouldn't work.

M2, which OS & IDE are you using?

The documentation in datasheet for the I2C registers looks identical for 328p and 1284p... I can't see any reason why it wouldn't "just work".

Ah, maybe I just don't see your posts here because I don't read this section much.

I may not post here much either. I think this will turn out to be some subtle software thing.

I am using 1.6.5 on Windows 7. I installed the J Christensen mighty-1284P files. in the 1.6.3 branch from github.

Previously, I have changed the TWI frequency in the twi.h file to 400000 because 100k is so slow on the LCD shield the refresh "scrolls" across the lines. I've had no issues with it at this speed on 328P and Mega. 328P is out of memory space, and Mega is a development board and my project needs a stand alone chip on a PCB.

Project demo is MONDAY! I hope I can get this all sorted out this weekend. Worst case, I use the Mega and hope they don't look "under the hood".

I have a function generator and 100MHz 2 channel scope for trouble shooting, just need some direction on what too look at.

With i2c scanner sketch running, no activity is on pins 22 or 23.

M2:
Anyone who has a 1284P and successfully using i2c please help!

I have a Bobuino, not a Bobweeny. Please state exactly which files you are using for the board (I can't see a download link on Bob's page). I would like to see exactly what pin mappings are used in them.

Provide a link to the files, please.

Here are the files I added to the IDE:

I am using YOUR i2c scanner sketch dated 20th April 2011.

Here is the pin map I pulled from pins_arduino.h

    ATMEL ATMEGA1284P Pinout
                       +---\/---+
     INT0 (D 4)  PB0  1|        |40  PA0 (AI 0 / D14)
     INT1 (D 5)  PB1  2|        |39  PA1 (AI 1 / D15)
     INT2 (D 6)  PB2  3|        |38  PA2 (AI 2 / D16)
      PWM (D 7)  PB3  4|        |37  PA3 (AI 3 / D17)
      PWM (D 10) PB4  5|        |36  PA4 (AI 4 / D18)
     MOSI (D 11) PB5  6|        |35  PA5 (AI 5 / D19)
     MISO (D 12) PB6  7|        |34  PA6 (AI 6 / D21)
      SCK (D 13) PB7  8|        |33  PA7 (AI 7 / D22)
                 RST  9|        |32  AREF
                 VCC 10|        |31  GND 
                 GND 11|        |30  AVCC
               XTAL2 12|        |29  PC7 (D 29)
               XTAL1 13|        |28  PC6 (D 28)
     RX0 (D 0)   PD0 14|        |27  PC5 (D 27) TDI
     TX0 (D 1)   PD1 15|        |26  PC4 (D 26) TDO
     RX1 (D 2)   PD2 16|        |25  PC3 (D 25) TMS
     TX1 (D 3)   PD3 17|        |24  PC2 (D 24) TCK
     PWM (D 30)  PD4 18|        |23  PC1 (D 23) SDA
     PWM (D 8)   PD5 19|        |22  iPC0 (D 22) SCL
     PWM (D 9)   PD6 20|        |21  PD7 (D 31) PWM
                       +--------+

With your scanner running, I scope pins 22 and 23 and not activity at all. I suppose I should scope each pin and see if any of them are singing my tune.

I have the SDA line from devices on 23 and SCL on 22 with a 4.7k resistor on each going to 5V.

Thanks in advance for any additional help.

I installed GitHub - JChristensen/mighty-1284p at v1.6.3

However I can't upload to my Bobuino. Do you know (you probably do) where you got the Optiboot loader for the 1284 from? Also, which board do you have selected in the IDE, exactly?

Never mind, I found it. Installed Optiboot, tested OK. Now to look into I2C.

The Optiboot was preloaded by Robert on the chips I bought from him. The pinout for Bobweeny and Bobuino are the same, just missing all the bells and whistles. Basically a 1284P Pro-Mini, but you know that already.

Thanks again for your assistance, and I look forward to a viable solution.

I'm not sure I have a solution for you, because I can't reproduce your problem. Using my Bobuino, I uploaded the bootloader file optiboot_atmega1284p.hex from the download GitHub - JChristensen/mighty-1284p at v1.6.3.

I then selected "Bobuino and Skinny Bob, 16MHz using Optiboot" in the IDE, and uploaded my I2C scanner.

This was the output:

I2C scanner. Scanning ...
Found address: 32 (0x20)
Done.
Found 1 device(s).

The scope showed reasonable signals (they would have been better with pull-up resistors):

I had the Bobuino connected to a MCP23017 like this:


Then I tried with my "bare bones" board here:

I had trouble uploading with the bootloader so I installed a slower bootloader using a slower system clock (the board might have been noisy), namely: optiboot_1284p_8MHz_57.6k.hex

I had to fiddle with the boards.txt file to add an entry for that bootloader. This shouldn't affect you, as you said you could upload OK.

Afterwards it also worked with I2C, giving the same output as earlier.


Can you confirm exactly what board you have selected in the IDE?

IDE board selection: Bobuino and Skinny Bob, 16MHz using Optiboot.

Nick, thank you so much for your help. I'm not sure if a pin wasn't seated right or what, but after starting fresh and double checking every wire, it is now WORKING!!!!

I2C scanner. Scanning ...
Found address: 25 (0x19)
Found address: 30 (0x1E)
Found address: 107 (0x6B)
Found address: 119 (0x77)
Done.
Found 4 device(s).

I really appreciate you taking the time to help the new guys in the community like me. Silly roadblocks like this one can be so frustrating! Now to burn the midnight oil and finish this project.

It is a racing kart Tach and datalogger with telemetry, recording to a SD card. Senior Design project for college. Monday is my last day of class!

Thanks for the help Nick.

My pleasure, Bob.

And just to show what the pull-up resistors do, here is what the waveforms look like without them:

And, with 4.7k pull-up resistors:

Notice how the signal is much squarer looking.

Yes, the internal pullups are way too weak for I2C. 4.7K makes a huge difference, or 2.7K/3.3K for pullup to 3.3V.
Especially if one wants to run at 400K.