Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
STM32f10x -- ADS1115 -- I2C
#1
hello guys ,

i have a problem with the communication between STM32F103 and ADS1115 i have a very simple code ,which just establisch the connect but i always have the AF Flag set ...
in the datasheet of ADS1115 the address is 1001000 when the ADDR pin is connected to GND and so it is in my case and one bit   left shift means 10010000=0x90 .
now when i generate start bit and then send the address the AF goes to "1" Acknowledge failure and thats mean the address doesnt match !!!
any help would be appreciated .
this is the code :

Code:
#include "stm32f10x_conf.h"
#define ADS1115_Address  0x90

int main(void){
      GPIO_InitTypeDef GPIO_InitStructure;
     I2C_InitTypeDef I2C_InitStructure;
   



     RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE);
     RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);

     GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
     GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
     GPIO_Init(GPIOB, &GPIO_InitStructure);

     GPIO_PinRemapConfig(GPIO_Remap_I2C1, ENABLE);

     I2C_DeInit(I2C1);

     I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
     I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
     I2C_InitStructure.I2C_ClockSpeed = 100000;
     I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
     I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
     I2C_InitStructure.I2C_OwnAddress1 = 0;
     I2C_Init(I2C1, &I2C_InitStructure);
      I2C_Cmd(I2C1, ENABLE);

            I2C_GenerateSTART(I2C1,ENABLE);
           
           I2C_Send7bitAddress(I2C1,0x90,I2C_Direction_Transmitter);
}
Reply
#2
Not sure, but maybe try 0x48 instead of 0x90
Reply
#3
hello vorosj,

i have already tried but still having AF=1 ...
Reply
#4
Hi...Is that all your code? You're falling out of your main function if so.What he's saying is that int main (void) makes no sense in bare metal microcontroller applications. The STM32F10x also has has the same code to re-enable the bulk in endpoint.

pcba board
Reply
#5
(25-05-2018, 06:37 PM)BurchSung Wrote: Hi...Is that all your code? You're falling out of your main function if so.What he's saying is that int main (void) makes no sense in bare metal microcontroller applications. The STM32F10x also has has the same code to re-enable the bulk in endpoint.
Huh? And you already have two stars?
-e
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)