On Fri, Jun 29, 2012 at 9:34 AM, Xavier RIVIERE
<address@hidden> wrote:
Hi,
I already post a lot about my I2C problem with Lisa/L + aspirin v1.5 + v3.9 configuration. After checking my electronics, I check the software. And finaly, it's working !!
Well... I change so much things that I'm not sure what is the main part... As I'm not in the dev team, and I don't want to open my own branch, I'm posting here my change.
----------------------
First, in my conclusion, the problem don't come from the I2C driver... I made little change here. I just put this line
while ((regs->CR1 & 0x200) == 0x200);
before each I2C_GenerateSTART and I2C_GenerateSTOP, to avoid double send, as describe in STM32 datasheet
Add this line if need in the function :
I2C_TypeDef *regs = (I2C_TypeDef *) periph->reg_addr;
----------------------
So, for me, the problem come from the I2C driver call... that's really a mess. There is T.H.R.E.E. calling function :
send_i2c_msg_with_retry
i2cSubmit
I2CTranmit
I put i2cSubmit everywhere -____-
----------------------
I change the function imu_periodic, in imu_aspirin.c this way :
http://pastebin.com/aWNAXQf1
I change the function imu_aspirin_event this way :
http://pastebin.com/vvXkNnkD
I change the interrupt function in stm32/imu_aspirin_arch.c :
http://pastebin.com/Ar0gD9fr
I activate the interrupt for the mag.
How it works ??
- Captor send interrupt
- Interrupt handler happen, and send i2c reading
- imu_aspirin_event catch the reading end, and send according handler
- imu_aspirin_periodic works as a watchdog. Mag timeout must be around 30+. Accel and Gyro timeout must be around 3+
------------------------
Hope this will help. If someone can test it before validate, it would be great ;)
Xavier
_______________________________________________
Paparazzi-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel