AnsweredAssumed Answered

I don't know why STM32F427 I2C3 will send the byte repeat?

Question asked by huang.ethan.001 on Mar 4, 2016
Latest reply on Mar 5, 2016 by huang.ethan.001
Hi all,

Are there have any one know this problem, I have to trying send only one byte via I2C3, but
I don't know why STM32F427 I2C3 will send the byte repeat?
 
uint32_t I2C_WrBuf(I2C_TypeDef* I2Cx, uint8_t DevAddr, uint8_t *buf, uint32_t cnt) {
  
  I2Cx->CR1 |= I2C_CR1_START;
  I2Cx->DR = (DevAddr << 1) | I2C_Direction_Transmitter;  
  I2Cx->DR = 0x30;             /* Here is very simple to send one byte */
  I2Cx->CR1 |= I2C_CR1_STOP;

2016-03-05_002902.png

Below is I2C3 config.
    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA , ENABLE);
    RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC , ENABLE);

    GPIO_PinAFConfig(GPIOA, GPIO_PinSource8, GPIO_AF_I2C3);
    GPIO_PinAFConfig(GPIOC, GPIO_PinSource9, GPIO_AF_I2C3);

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
    GPIO_InitStructure.GPIO_PuPd  = GPIO_PuPd_UP;
    GPIO_Init(GPIOA, &GPIO_InitStructure);


    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
    GPIO_Init(GPIOC, &GPIO_InitStructure);

    RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C3, ENABLE);
    RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C3, ENABLE);
    RCC_APB1PeriphResetCmd(RCC_APB1Periph_I2C3, DISABLE);

    I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
    I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
    I2C_InitStructure.I2C_OwnAddress1 = 0x00; 
    I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
    I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
    I2C_InitStructure.I2C_ClockSpeed = 50000; 

    I2C_Init(I2Cx, &I2C_InitStructure);
    I2C_Cmd(I2Cx, ENABLE);

Outcomes