2019-03-26 03:29 AM
Hi,
I am using NUCLEO -F722ZE board for testing the STM32F7 and their peripheral features. Other peripherals I tested works fine, but I have encountered a problem with I2C2 in slave mode, that doesn't send ACK when the master calls it (status flags keeps idle too).
STM32 core and AHB/APB buses are working at maximum speed (216MHz, 108MHz, etc...).
Here is the code:
// 1st configuring RCC, GPIO, and reset for enable I2C2:
RCC->APB1ENR=0x3040000B; // I2C2 (and others) clocked
RCC->APB1RSTR=0xE2F7CBFF; // Reset I2C2
RCC->APB1RSTR&=0xCFBFFFF4; // Free reset of I2C2
GPIOB->MODER=0x55A55555; // PB10 PB11 in alternate function
GPIOB->OTYPER=0x00000C00; // PB10 PB11 open drain
GPIOB->ODR=0x00001C00; // PB10=Higo PB11=High preventively
GPIOB->PUPDR=0x00000000; // No pullups (I use external ones)
GPIOB->AFR[1]=0x00004400; // PB10=I2C2_SCL, PB11=I2C2_SDA
// I2C2 config as Slave at addres 0x0B:
I2C2->CR1&=~I2C_CR1_PE; // preventively disable peri
I2C2->OAR1=0x00008016; // 7-bit addr is 0x0B
I2C2->CR1=0x0003107E; // Some ints enabled (I tried other configs for this register)
I2C2->CR1|=I2C_CR1_PE; // Finally, enable peripheral
That is the simpliest config can I do. With this, I2C2 must ACK at their call, but this is the result:
Please, don't take care with low level of SCL at end, things of the master, but see the 9th bit is NACK.
Can somebody help me? Thanks.
Solved! Go to Solution.
2019-03-26 05:15 AM
Guys, forget this post. The problem was a briken trak in PCB. Sorry for the disturbances.
I levae the post for help other people. Configuring code works fine.
2019-03-26 05:15 AM
Guys, forget this post. The problem was a briken trak in PCB. Sorry for the disturbances.
I levae the post for help other people. Configuring code works fine.