I'm Road Testing the Rohm SensorShield-EVK-003 (Arduino Compatible) and the sensors that come with it.

In this post, the Accelerometer Sensor KX224-1053KX224-1053.

This post turns out differently than I intended. I was going to test the device directly on a Hercules micro controller, but I have difficulties creating an i2c restart condition on that controller.

I logged a support request for that.

Instead, I have used this post to document and prepare for the exercise, collect the traffic of ROHM's Arduino example, and draw the connections that I'll use when porting to the Hercules.

 

 

 

The KX224-1053 is a little versatile chip. Versatile because it supports both SPI and i2c.

It's sensitive, has an algorithm for free fall (and a few other interesting services, like directional tap and double tap detection), has wake-up, a data buffer and supports interrupts.

 

It's worth reading the specifications document. The non-basic things that this controller are impressing (e.g: the triggers)

 

FFI1 – Free fall interrupt reported on physical interrupt INT1

BFI1 – Buffer full interrupt reported on physical interrupt pin INT1

WMI1 – Watermark interrupt reported on physical interrupt pin INT1

DRDYI1 – Data ready interrupt reported on physical interrupt pin INT1

TDTI1 – Tap/Double-TapTM interrupt reported on physical interrupt pin INT1

WUFI1 – Wake-Up (motion detect) interrupt reported on physical interrupt pin INT1

TPI1 – Tilt position interrupt reported on physical interrupt pin INT1

 

You can combine the X, Y and Z axis via AND and OR logic for some of these interrupts.

You have the possibility to define 2 of them. There are two sets and registers and two physical interrupt pins in the package.

 

Voltage range from 1.71 to 3.6 V.

Little because it is very small. 3 x 3 mm. Less than a mm high.

 

 

 

The ROHM SensorShield breakout uses i2c. There's little more on the board than the sensor and decoupling capacitors.

 

 

 

Capture Arduino Example i2c Traffic

 

As first step in getting the sensor to work on another controller, I try to collect the i2c traffic of ROHM's Arduino example.

The example is straightforward. It initialises the sensor, then polls the three axis regularly.

 

Here's the capture of the initialisation sequence:

 

 

And here the protocol to get data, including reading the data for axis X, Y and Z

 

 

The traffic looks like the table below. The one I have difficulties with on the Hercules is the restart without stop in row 5.

 

I2C Analysis results


Bus configuration
SDAChannel 1
SCLChannel 0
Statistics
Decoded bytes44
Detected bus errors0
IndexTimeHexBinDecASCII
05,00 nsSTART
15,07 μs0x3c0b0011110060<
294,56 μsACK
399,70 μs0x0f0b0000111115
4189,88 μsACK
5209,71 μsSTART
6214,77 μs0x3d0b0011110161=
7300,70 μsACK
8305,84 μs0x2b0b0010101143+
9395,02 μsNACK
10415,90 μsSTOP
11781,35 μsSTART
12786,41 μs0x3c0b0011110060<
13875,84 μsACK
14880,97 μs0x180b0001100024
15971,15 μsACK
16976,29 μs0x400b0100000064@
171,07 msACK
181,09 msSTOP
191,11 msSTART
201,12 ms0x3c0b0011110060<
211,21 msACK
221,21 ms0x1b0b0001101127
231,30 msACK
241,31 ms0x020b000000102
251,40 msACK
261,42 msSTOP
271,43 msSTART
281,44 ms0x3c0b0011110060<
291,52 msACK
301,53 ms0x180b0001100024
311,62 msACK
321,64 msSTART
331,64 ms0x3d0b0011110161=
341,73 msACK
351,74 ms0x400b0100000064@
361,83 msNACK
371,85 msSTOP
381,88 msSTART
391,88 ms0x3c0b0011110060<

 

For the reader, this will very likely be dull info. I hope it helps me with my next exercise ...

 

Hercules Microcontroller Preparation

 

I'm going to use a TMS570LC43TMS570LC43. It's on the high end of the Hercules range.

As explained before, my firmware does not work.

The hardware connection, very simple, should be OK though.

Rohm Accelerometer KX224-1053 and Hercules LaunchPad

 

I have everythin wired up and the i2c peripheral properly initiated.

My current status is that I can repeat the whole traffic, except that I have a STOP between line 4 and 5 in the table above.

I have been struggling with this before (and logged unresolved support requests for it). I had another chip that defined a restart, but it gladly ignored the extra stop.

This chip is more demanding and does not give a decent reply when the stop is there.

I don't blame ROHM. Restart is a normal i2c construct. But the Hercules is not an easily tamable controller.

 

Ironically, the Hercules has a programmable independent timer co-controller on board. I have working code for that co-controller that simulates i2c and supports restart ...