hi tobias, thanks for your replies to my questions.
i have a problem to understand how the initialization of the device actually works.
The EEPROM is currently only read at startup. Since the EEPROM will init i2c1 device you don't have to do that again.
i assume this happens in system.c in the function systemInit() when calling configblockInit().
configblockInit() however calls two functions:
Code: Select all
i2cdevInit(I2C1_DEV);
eepromInit(I2C1_DEV);
in the vl6180x thread you posted following code:
Code: Select all
uint8_t VL6180xInit(I2C_Dev *i2cPort)
{
uint8_t data; //for temp data storage
if (isInit)
return 0;
I2Cx = i2cPort;
devAddr = 0x29; // Check if it is the correct initial I2C address
data = VL6180x_getRegister(VL6180X_SYSTEM_FRESH_OUT_OF_RESET);
if(data != 1) return VL6180x_FAILURE_RESET;
//Required by datasheet
//http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00122600.pdf
VL6180x_setRegister(0x0207, 0x01);
VL6180x_setRegister(0x0208, 0x01);
VL6180x_setRegister(0x0096, 0x00);
VL6180x_setRegister(0x0097, 0xfd);
VL6180x_setRegister(0x00e3, 0x00);
VL6180x_setRegister(0x00e4, 0x04);
VL6180x_setRegister(0x00e5, 0x02);
VL6180x_setRegister(0x00e6, 0x01);
VL6180x_setRegister(0x00e7, 0x03);
VL6180x_setRegister(0x00f5, 0x02);
VL6180x_setRegister(0x00d9, 0x05);
VL6180x_setRegister(0x00db, 0xce);
VL6180x_setRegister(0x00dc, 0x03);
VL6180x_setRegister(0x00dd, 0xf8);
VL6180x_setRegister(0x009f, 0x00);
VL6180x_setRegister(0x00a3, 0x3c);
VL6180x_setRegister(0x00b7, 0x00);
VL6180x_setRegister(0x00bb, 0x3c);
VL6180x_setRegister(0x00b2, 0x09);
VL6180x_setRegister(0x00ca, 0x09);
VL6180x_setRegister(0x0198, 0x01);
VL6180x_setRegister(0x01b0, 0x17);
VL6180x_setRegister(0x01ad, 0x00);
VL6180x_setRegister(0x00ff, 0x05);
VL6180x_setRegister(0x0100, 0x05);
VL6180x_setRegister(0x0199, 0x05);
VL6180x_setRegister(0x01a6, 0x1b);
VL6180x_setRegister(0x01ac, 0x3e);
VL6180x_setRegister(0x01a7, 0x1f);
VL6180x_setRegister(0x0030, 0x00);
isInit = true;
return 0;
}
and you wrote
Also the VL6180 is connected to I2C1 so it should be initialized with VL6180xInit(I2C1_DEV)
That is, in my opinion, because one has to set the devAddr, is that right?
Now my question is, where in the code do i call my Init-function, that sets the device address for my device?
thanks for your answers.
Greets, Che
Edit:
Is it necessary to configure the I2C-Port for my own sensor? I am using the LIDAR LITE 2 by PulsedLight
http://pulsedlight3d.com/.
It has a special I2C-protocoll which i want to use. I am really stuck and my head is spinning because of all those structs
I am not able to read any registers as i am not sure the I2C-accessing lib is compatible to the device in the first place.
___
UPDATE 1:
Now I cleaned up with my pointers and get some readings from the lidar-registers.
Trying to get some proper distance readings now.
UPDATE 2:
Seems like I hit the same bug as mwall002 in his posts (updating of ToC didnt work), fixed it and now i am back the old problem.
Its hard to get the Device I2C1 to work as my sensor.
In my opinion we get in trouble when trying to stay in eeprom.c and modifying it.
Code: Select all
bool eepromInit(I2C_Dev *i2cPort)
{
if (isInit) //I think this part isn't necessary, because isInit is a global variable
return true; //s.o.
I2Cx = i2cPort; //s.o.
devAddr = EEPROM_I2C_ADDR; //here should be the lidar-adress
isInit = true; //s.o.
return true; //s.o.
}
When calling this function my crazyflie freezes.
can anybody help me?