Dear all

I am currently working in collaboration with Jon Verbeke on a project with multiple ultrasonic sensors on a quadrotor. We started from available analog ultrasonic sensors, an I2C ADC (analog to digital converter) to read out the sonars and I2C expander to trigger the sonars.

This setup was already implemented on an APM2.5 and we expected a similar implementation procedure on the Pixhawk. However, we were wrong :/ As we found out the best way to implement the i2c devices on the pixhawk is by writing drivers for them (see post).

We started with writing a drivers for the i2c expander (PCF8575) and plan to write one for the i2c  ADC(ADS7828) as well, if we get the hang of it! We would gladly share these drivers IF we can get them to work! The hmc5883 driver code is used as guiding example. Together with the drivers, libraries are being written. I start to understand most of the driver implementation. But i still have some issues and ran into a problem:

1)First how does the code know which driver it has to use? You can add drivers in arducopter/mk/PX4/config_px4fmu-v2_APM.mk but how are they linked to the library components? For example the compass: the only link i can find in the library files (AP_Compass_PX4.h en cpp) is a link to the drv_mag.h file. But this file does not link to the hmc5885 compass as far as i can tell.

2) Second the drivers and libraries compile and can be uploaded. But when i wanted to start to test the code by uploading a slightly changed code (set all pins to zero), i ran into a problem. The code still compiles, and uploads, but when it is done uploading the Pixhawk is getting in some kind of error state: the RGB led is solid red and the buzzer continuously makes 3 short and 3 long beeps. I can still upload other code, but i still get the same error signals (red + beeps).

Has someone else encountered this problem? Can some one lend me a hand with these issues? Or even better, has someone wirtten these i2c drivers for these boards? Anyhow when the drivers work they are made available to the community!!

Best regards

Jonas

Views: 1396

Reply to This

Replies to This Discussion

I have solved the issue of the three long beeps, three short beeps: no SD card found. I unplugged it and plugged it back in and it was resolved.

I changed the drivers and managed to upload them. The code runs now but it can't open the path to my "/dev/ioexpander". How do you have to make this path for new drivers? The compass has a path "/dev/mag".

regards Jonas

Hi,

Any news on this topic? I am trying to send data to an i2c device from Pixhawk and it is not working at all. No issue on APM 2.6, all running Arducopter 3.2.1...

Excuse me, Can data from external sensors incorporated into other applications , while flight mission took place to collect the data which is stored in the log APM ?  for example I have a program that can automatically realtime plotting external sensor data and geo tagging of logs apm
Unfortunately, I had to rethink everything and my choice was to develop an external program and dedicated telemetry to get geotagged data from external sensors.

Reply to Discussion

RSS

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service