2017-03-28 01:56 PM
Hello, I still tried with I2C on nucleo F401RE. I am use STM32CubeMx for generate files, but my program is not working. I want send three bytes on I2C in blovking mode. This is my code:
I2C not working, still is log. 0 on SDA and SCL. Please help me.
In rar. is all files.
int main(void)
{/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();/* Configure the system clock */
SystemClock_Config();/* Initialize all configured peripherals */
MX_GPIO_Init(); MX_I2C1_Init();/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
uint8_t buffer[3]={0x33,0x87,0X76};
while (1)
{ HAL_I2C_Master_Transmit(&hi2c1,0X40,buffer,3,10); HAL_Delay(100); HAL_GPIO_TogglePin(GPIOA,GPIO_PIN_5);/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */}
#hal #smt32-nucleo #cube-mx #i2c2018-02-27 02:52 AM
Hallo, have u done with this issue?
2018-02-27 05:07 AM
After very nearly a year, one would hope so!
2018-02-27 06:27 PM
I has some like a bug in CubeMX,
Condition:I use STM32l073Rz, When I generated a code with setup I2C1 :Primary Slave Address : 0x02 in CubeMX,
Primary Address Length Selection : 7 bit.
But output script shown 0x04,
When I change 0x01, output script shown 0x02.2018-02-28 03:32 AM
Sounds like one is using the 7-bit address right-aligned in a byte, and the other has it left-aligned...
http://www.avrfreaks.net/comment/1872781&sharpcomment-1872781