AnsweredAssumed Answered

STM32F030 I2C waveform non-continuous or stretched using HAL_I2C_Master_Transmit

Question asked by sid.fad on Apr 4, 2015
Need some help. The I2C seems to not behave as how I expect it to be. I am using fairly standard code. I furnish the necessary address and wish to transmit 3 bytes of data to the slave.

However after acknowledging the address, the Master seems to stretch the clock by holding the line low. I do not want that. I need continuous clocking. How can I do that? and interestingly HAL_I2C_Master_Transmit and HAL_I2C_Master_Transmit_IT behaves differently(even worse) stretched between each data byte! How can I achieve a continuous clocking with no clock stretch? I need the Address block + the 3 blocks of data to be continuous. Thanks in advance.

//--------------------Setup-------------------

I2CHandle.Instance = I2C1; //using SCL = PB6 and SDA = PB7

I2CHandle.Init.Timing          = 0x00200208; //using stm32cubemx
I2CHandle.Init.OwnAddress1     = 0;  //not used since always in master mode
I2CHandle.Init.AddressingMode  = I2C_ADDRESSINGMODE_7BIT;
I2CHandle.Init.DualAddressMode = I2C_DUALADDRESS_DISABLED;
I2CHandle.Init.OwnAddress2     = 0;  //not used
I2CHandle.Init.GeneralCallMode = I2C_GENERALCALL_DISABLED;
I2CHandle.Init.NoStretchMode   = I2C_NOSTRETCH_ENABLED;
I2CHandle.Init.OwnAddress2Masks = I2C_OA2_NOMASK;

//-----------------------Transmit------------------------
 while(HAL_I2C_Master_Transmit(&I2CHandle, (uint16_t)(I2CADDR<<1), (uint8_t*)aTxBuffer, 3, 100)!= HAL_OK)



pic_80_1.gif

Outcomes