ads1115 stm8 integration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-13 10:25 PM
hello,i am a beginner & i am trying integrate an external adc "ads1115" with stm8. the adc is an i2c device . i tried using peripheral library and also the register way. but its not working can anyone guide me the corect way to integrate this.this is my code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-15 4:02 AM
First while ((I2C1->SR1 & I2C_SR1_SB));
should be: while (!(I2C1->SR1 & I2C_SR1_SB));
Missing !
You are not reading SR3 register. See RM0016 page 295:
Then the master waits for a read of the SR1 register followed by a read in the SR3 register.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-16 12:44 AM
I HAVE ADDED THE ! TO THE LINE , AND WHEN DEBUGGING THE CODE STOPS AT while (!(I2C1->SR1 & I2C_SR1_SB));
I AM USING STM8L052C6 MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-16 3:29 AM
On STM8L family, before work with a peripheral, you must enable the peripheral clock. It is called Peripheral clock gating.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-24 2:02 AM
i have made another project for the ads1115 integration for stm8l052c6 ..with peripheral clock and all
in this code also stops aftr the i2c is started , when the address is being send to slave
have any suggetion
also can anyone provide a i2c scanner code for stm8l052c6 mcu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-24 7:38 AM
I2C needs two external pull-up resistors of about 4K7 on SDA and SCL pins. Do you have the resistors?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-25 9:14 AM
Yes, I have on board 10k pull-up resistors for both SDA and SCL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-11-26 3:45 AM
I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED tests flags BUSY, MSL, ADDR, TXE and TRA
RM0031 page 511:
ADDR is cleared by software reading SR1 register followed reading SR3. If tested flags don't appear at same time, ADDR is cleared and condition is always false.
You must improve your code. Follow RM0031 I2C steps.
