2024-03-11 10:17 PM
Hi everyone
I'm now using D6T-44L Omron sensor to measure Temparature, i read the User mannual as the below
After that, i write my own code in IDE
i use I2C_Scanner to check the device at which address is ready, here are my code and my result through UART to PC
It seems everything is okay but my return value is always 255
Solved! Go to Solution.
2024-03-12 12:35 AM
Thank for your reply,
I just found the solution
In HAL_I2C_Master_Transmit, i need to pass the address of the data command, because it is a pointer to data
so i need to modify the code like below
2024-03-11 11:22 PM
Hello Zk47,
I dont know if this is the case since i could not find any proper datasheet for your component, maybe you can share it. But sometimes, i2c devices have 2 address, one to read and one to write, for example:
#define EEPROM_ADDR_WR 0xA0
#define EEPROM_ADDR_RD 0xA1
i use these for an ee24lc512 eeprom, maybe it doesnt make any sense in your case, but just to let you know that.
Also, some othere devices need kind of initialization, in your code, you are only initializing the i2c driver in the MCU, but sometimes there are few commands to initialize/configure the device itself.
I can for example talk about the rc522, it needs couple of registers writes each time you power it up.
Hope it helps.
Greetings
2024-03-12 12:35 AM
Thank for your reply,
I just found the solution
In HAL_I2C_Master_Transmit, i need to pass the address of the data command, because it is a pointer to data
so i need to modify the code like below
2024-03-12 01:04 AM
Hi
some basic questions: The Pullup are done? The I²C speed is max 100kHz?
Basic2:
The STM HAL takes the "shifted" address for read and write.
So your read and write adress have to be the same (0x14) the read/wirte bit will be managed by the HAL_
in your scanner you make a shift in the device ready with "i" but yo display the teh unshifted "i"
So try Transmit with adrr = 0x14 and a receive with adrr = 0x14
hth
padawan