Odroid W ADC

One of the advantages of the Odroid W is that is has 2 onboard ADCs that are perfect for the current/voltage sensor. They support up to 2.5v max while the AttoPilot 90A/50V goes to 3.3v max. This reduces the range to 67A and 37V which is more than enough for the 50A silkopter will use at max throttle.

Hardkernel provided a Raspbian image with the modules needed to get the 5T619 chip functional – including the adc – but when I tried it a few weeks ago the mpu9250 was getting regular bus errors and even kernel panics.

A few days ago I decided to test some more on a raspberry pi model A, to eliminate any unknowns from the odroid w board. So I connected a SRF02 sonar to i2c-0 to simulate the 5T619 and the mpu9250 to i2c-1. Simply trying to talk to both of them resulted in kernel panics. After 2 evenings of debugging it turns out that the hardkernel raspbian kernel had combined transactions turned on and the i2c-bcm2708.c kernel module has an issue with combined transactions if one or both of the busses has heavy traffic. I managed to find the bug – a small one actually – and the kernel panic was gone.

So I could talk to the mpu and I could talk to the sonar and also the adc chip on the odroid board.

However, as soon as I started raspivid or raspistill – or anything using the camera – i2c-0 stopped working even after killing the process. Turns out that the GPU makes use of the i2c-0 to talk to the camera and it changes the SCL.0 and SDA.0 pins from ALT0 to IN. And it leaves them like that until a reboot or I manually change them back…

So now I have the ADC working, the camera working as well but not both together. My only chance is to change the i2c-0 pin mode back to IN after every call to mmal and hope the camera doesn’t use the bus between mmal calls. Hopefully this will fix the issue but it’s a very ugly hack.

At least I have ADC working, the battery module committed in the brain and integrating the battery capacity from the current readings.

Next I want to autodetect the number of cells in the battery and estimate the capacity at startup.

Also it would be nice if the ground station detected when the battery was replaced and ask for the capacity of the new one.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s