I have an i2c oled display with an SSD1306 driver. I want to drive this display with my nucleo card. Pin configurations are shown below.
I provided the i2c connection on the display via i2c1 on the development board. I know that the slave address is 0x3C, but I wanted to check if the display is connected. I couldn't get any address output over UART, below is the code I used for scanning.
/*-[ I2C Bus Scanning ]-*/
HAL_UART_Transmit(&huart2, StartMSG, sizeof(StartMSG), 10000);
for(i=1; i<128; i++)
{
ret = HAL_I2C_IsDeviceReady(&hi2c1, (uint16_t)(i<<1), 3, 5);
if (ret != HAL_OK) /* No ACK Received At That Address */
{
HAL_UART_Transmit(&huart2, Space, sizeof(Space), 10000);
}
else if(ret == HAL_OK)
{
sprintf(Buffer, "0x%X", i);
HAL_UART_Transmit(&huart2, Buffer, sizeof(Buffer), 10000);
}
}
HAL_UART_Transmit(&huart2, EndMSG, sizeof(EndMSG), 10000);
/*--[ Scanning Done ]--*/
I tried to drive the display with different sample codes, but I was not successful with the nucleo board. There is no problem with the display because I can drive it with Arduino.
I couldn't find where I went wrong, can you help?