2012-11-20 09:54 AM
2012-11-20 11:31 PM
When I attach the STM, I cannot get the line to go low. I've tried changing a number of different values during the I2C_Init() phase, but none seem to change the fact that the STM32 is holding the line high.
That is not the way I2C works. By definition, SDA and SCL need to be open-drain, to have multiple devices/masters on the bus. This pins are only high if no other device pulls it low. If one device pulls the bus low, the others cannot pull it up. In effect, this means your bus master probably feigns death.2) When the EEPROM is sitting on the bus by itself, the voltage of both SCL and SDA are 5.04V.
Not a good idea. The STM will only work with 3.3V bus voltage. Either reduce the supply (and bus) voltage of the other devices, or use level shifters. There is a chance that the other problems disappear then.
2012-11-21 03:13 PM
Thank you very much for your response. It has given me some new thoughts. I did not realize that the stm i2c bus works on 3.3v not 5v.
When I attach the STM, I cannot get the line to go low.That is not the way I2C works. By definition, SDA and SCL need to be open-drain, to have multiple devices/masters on the bus. This pins are only high if no other device pulls it low.
If one device pulls the bus low, the others cannot pull it up.
In effect, this means your bus master probably feigns death.
What I meant is I can't get other devices to pull the line low when the STM is attached. I can communicate with my EEPROM using the Aardvark, but only when the STM is not attached to the bus. Once I attach the STM, when the Aardvark tries to send a message, nothing happens. Right now I would be happy just to have the STM sitting on the i2c bus doing nothing, passive, while other devices talk to each other.
2012-11-22 12:38 AM
Once I attach the STM, when the Aardvark tries to send a message, nothing happens. Right now I would be happy just to have the STM sitting on the i2c bus doing nothing, passive, while other devices talk to each other.
This means, the STM is assumed to be an i2c slave. You will need to configure it in this way. Most code examples around here assume the STM as master.
2012-11-23 10:11 AM
Okay. Away from the lab right now visiting family, but when I get back I will give that a try as well.
I did switch the bus supply to 3.3v, but still no luck trying to get the STM to send a write signal (this was with only the STM and the EEPROM attached to the bus). The code continues to hang while checking to see if the line is free.Thank you for your responses. Hope you are having a good holiday.From: fmPosted: Thursday, November 22, 2012 9:38 AMSubject: Frustrating I2C Problem: STM32L-DiscoveryOnce I attach the STM, when the Aardvark tries to send a message,nothing happens. Right now I would be happy just to have the STM sittingon the i2c bus doing nothing, passive, while other devices talk to eachother.
This means, the STM is assumed to be an i2c slave.You will need to configure it in this way. Most code examples around here assume the STM as master.
2012-11-24 06:49 PM
Good news! I got the STM32L to talk! I was using the wrong pins!
I was able to make it communicate using a bus voltage of both 5v and 3.3v. Other minor problems involved trying to use the pins for two different Alternate Functions at the same time.If anyone is interested in the source then please send me a PM!Thanks for your help fm2012-11-25 05:17 AM
If anyone is interested in the source then please send me a PM!
Not sure the forum has such a feature, suggest you provide a public email address, or external link, if you which others to contact you.2012-11-27 07:46 AM
Looks like you are correct. If anyone is interested in discussing I2C on this particular board, drop a line to aubiesatsoftware@gmail.com.
Here's something perplexing: I can get the I2C bus to work on pins PB10 and PB11 (I2C2), but the same code won't work on pins PB6 and PB7(I2C2). Any thoughts? EDIT: Page 37 contains a description of the Main & Alternate functions of PB10 and PB11Page 39 contains a description of the Main & Alternate functions of PB6 and PB7I think this has something to do with PB6 and PB7 being connected to LED3 and LED4.When I plug those pins into the I2C bus (remember it's pulled up) those LEDs light up.http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00277537.pdf2012-11-27 08:15 AM
Here's something perplexing: I can get the I2C bus to work on pins PB10 and PB11 (I2C2), but the same code won't work on pins PB6 and PB7(I2C2). Any thoughts?
...
I think this has something to do with PB6 and PB7 being connected to LED3 and LED4.
When I plug those pins into the I2C bus (remember it's pulled up) those LEDs light up.
Most likely this is the case. I wouldn't waste too much time trying to find out which one of the bus participants is not willing to drive this LED. Easiest way is probably to remove the LED, as the discovery board is rather cheap.
2013-03-20 04:49 AM
Hello hoodjay,
I'm trying to use the i2c on the same device.Could you please send me the code?Are you using interrupts in your code or while's?Thanks,Michael