Home→Forums→MonoBrick EV3 Firmware→Dexter dIMU Support
- This topic has 7 replies, 2 voices, and was last updated 10 years, 9 months ago by Anders Søborg.
-
AuthorPosts
-
March 1, 2014 at 19:01 #4007
Martin ZenkelParticipantHi,
building up some balancing vehicle I’m trying to implement the Dexter dIMU I²C-sensor, especially the accelerometer
http://dexterindustries.com/manual/imu-sensor/
http://dexterindustries.com/files/dIMU_Datasheets.zipI’m deriving from I2CSensor which seems to be very straightforward. The problem is that every Read../Write.. call attempt hangs (e.g. setting the mode or reading a value from the appropriate hex register address). The same applies to the gyro on the same device (of course with the correct I²C- and register-addresses). After reading some lines about the I²C bus I wonder if it might be the case, that MonoBrick Firmware doesn’t support some special I²C detail (maybe another mode) yet?
The same device (both the accelerometer and the gyro) delivers measurement values with the standard EV3 software, using the blocks from
https://github.com/DexterInd/EV3_Dexter_Industries_Sensors/raw/master/Dexter.ev3bUnzipping this file and analyzing the *.vix-files in it gives me no hint (apart from a I²C-address shift, which I tried too).
Do you have any idea? Thank you in advance.
Best regards,
MartinBTW: MonoBrick Firmware is a really great project!
March 1, 2014 at 19:25 #4008
Anders SøborgKeymasterHi
Try to use this as a starting point. My guess is that you did not call the initialize on the base class in your constructor. Post some code if this does not work. Also when you are done make a pull request on github – then you can help expand the number of sensors that are supported by MonoBrick firmware…
Anders
March 1, 2014 at 22:26 #4011
Martin ZenkelParticipantHi, thank you for the very quick response.
To answer your hints and proposals:
I already cloned the github monoev3 repository to check the code of the handful of I²C-sensor implementations that ship with MonoBrick firmware and I already did call
Initialise()
on the base class in the constructor. This is the code (excl.ReadAsString
):public class DexterAccelerometer : I2CSensor { public DexterAccelerometer(SensorPort port) : base(port, 0x3A, I2CMode.LowSpeed) //0x3A: Dexter-dIMU-documentation, 0x1D: Freescale-datasheet { Initialise(); byte mode = 0x01 << 3 + 0x01; //4g measurement WriteRegister(0x16, mode); //THIS CALL DOES NOT RETURN } }
In my previous post the I²C details of MonoBrick Firmware and the I2CSensor class came into my mind because I took a look at the Tutorial Segway with RobotC. There the Dexter dIMU gets initialized with a I²C mode constant named
sensorI2CCustomFastSkipStates
, whatever that means. This mode is one of six according to the RobotC driver suite common file (line 218ff). So compared to RobotC I guess that MonoBrick Firmware implements ‘only’ thesensorI2CCustom
andsensorI2CCustom9V
mode (equivalent toI2CMode.LowSpeed
andI2CMode.LowSpeed9V
) – just a guess.Secondly, what strengthens my suspicion: In the Dexter’s ev3b block description (unzipped, in Accel4.vix) they write decimal
...DataType="Byte[]">[29,22,9]...
for the “Accelerometer Initialization 4G” (as the comment below states). It seams that they send only three bytes, containing hex [1D,16,9] which means [I²C address, register address, value]. Looking into MonoBrick Firmware’sI2CSensor.WriteAndRead
implementation it seams that some overhead is built around this essential 3-byte information. Might this be an incompatibility? Sorry, but maybe I’m completely wrong. 😉(Apart from that, my confusion with the “I²C address shifting”-topic is resolved in so far, as I have meanwhile seen
I2CAddress >> 1
in yourI2CSensor.WriteAndRead
implementation. So I use the “left shifted” one, as shown and commented in the snipped above.)March 1, 2014 at 22:43 #4012
Anders SøborgKeymasterHi Again
You might get some helpful info here – but you will have to do some reverse engineering 🙂
I have to go to bed now, but please let me know how it goes…
Anders
March 2, 2014 at 15:55 #4015
Martin ZenkelParticipantThank you, I’ll take a look at it.
MartinMarch 4, 2014 at 18:53 #4023
Anders SøborgKeymasterPlease let me know how it goes. I would really like to support more sensors
Anders
March 12, 2014 at 22:13 #4043
Martin ZenkelParticipantHi Anders,
sorry for the late response.
After comparing both I2CSensor implementations (down to some IO-related UnixDevice class) I could not resolve my Dexter dIMU I²C communication issue.
To proceed with my main objective I’m using the HiTechnic tilt sensor now which is already implemented in MonoBrick Firmware. It is an I2CSensor too but/and it works fine. I’m doing some research concerning timing, threading and so on in order to get a responsive/reproducable balancing loop solution. Further more I’m working on various details, e.g. wondering if (and hoping that) there will never be a time-consuming garbage collector or background system task that breaks my balancer activity.
I think I’ll come back to the dIMU later, keeping you up-to-date of course.
Best regards, Martin
March 17, 2014 at 19:11 #4051
Anders SøborgKeymasterHi
Please remember to let us all know how this goes…
Anders
-
AuthorPosts
You must be logged in to reply to this topic.
Follow