Sterling
Sterling
DIIDevHeads IoT Integration Server
Created by Sterling on 7/2/2024 in #middleware-and-os
Could you guys help please review my code and suggest any potential mistakes or improvements?
Good day guys, I'm currently working on a project involving the MCP3424 ADC module and an STM32 microcontroller. My intention is to verify whether the MCP3424 is connected to the master STM32 at the defined address 0x68. While the ADC module successfully connects to an Arduino at the same address, I am facing issues with the STM32 connection. This is my code ;
while (1) { /* USER CODE END WHILE */

/* USER CODE BEGIN 3 */
if((HAL_I2C_IsDeviceReady(&hi2c1, 0x68 << 1, 100, 1000))==HAL_OK){
HAL_UART_Transmit(&huart2, (uint8_t*)"device connected\r\n", 18, 10);
}
else{
HAL_UART_Transmit(&huart2, (uint8_t*)"no device\r\n", 11, 10);
}
}
while (1) { /* USER CODE END WHILE */

/* USER CODE BEGIN 3 */
if((HAL_I2C_IsDeviceReady(&hi2c1, 0x68 << 1, 100, 1000))==HAL_OK){
HAL_UART_Transmit(&huart2, (uint8_t*)"device connected\r\n", 18, 10);
}
else{
HAL_UART_Transmit(&huart2, (uint8_t*)"no device\r\n", 11, 10);
}
}
With this, I am still unable to establish a connection with the MCP3424 using the STM32. The error output keeps showing "no device". Could you guys help please review my code and suggest any potential mistakes or improvements? Also, if there are specific considerations or configurations needed for interfacing the MCP3424 with the STM32, please I would love to know. Thanks guys 🙏.
@Middleware & OS
10 replies