2011-11-21 03:18 PM
Hi all,
I am very new to the STM32, currently using the STM32L.. As I am new to developing on this platform (Never touched anything ARM before), I am overwhelmed by the amount of documentation although trying to dig out the bits that are useful is a little confusing to me right now. While there is lots of information about i2c, it is very application specific (EEPROM etc). Some times I think simple is best. I am wondering if anyone would be able to take the time to help me? I am using the standard lib and using TrueStudio. I would like to see if anyone could create or already has an example of the following: Setting up i2c, Setting the micro as the master, checking the presense of the device at address 0x40 and verifying the ACK and sending data to it, and maybe as a brucie bonus being able to do the same for a second device on the same bus. The actual slave is an IO extender device that I am using to test i2c. Now I could go and read through the documentation again lots of times and try and get the bits I need. I have tried and failed to break bits out of the ST help files. Your efforts are most apreciated :) Many Thanks Paul2011-11-24 06:32 AM
Hi Robin,
Thank you for that, I shall try moving those about. Many Thanks Paul2011-11-24 06:47 AM
/*!< Configure I2C SCL pin */
GPIO_InitStructure.GPIO_Pin = GPIO_PinSource6;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
..
/*!< Configure I2C SDA pin */
GPIO_InitStructure.GPIO_Pin = GPIO_PinSource7;
These don't use GPIO_PinSourceX (an index), but GPIO_Pin_X (a bit field) /*!< Configure I2C SCL pin */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; .. /*!< Configure I2C SDA pin */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;
2011-11-24 07:00 AM
Hi Clive,
Doh! It just shows how little I know about this platform at the moment, I shall change them over when I get home. Thank you very much all Paul2011-11-24 10:45 AM
Excellent, i2c is now alive :) Well at least im getting past I2C_EVENT_MASTER_MODE_SELECT.
I am now timing out on I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED. But I will take more of a look into that. Thanks all Cheers Paul2012-07-20 10:13 PM
Hi Paul,
I am new at I2C at stm32, Can you send me your latest version of your code?does it contain IT ?