Page 1 of 1

Kinetis I2C0 Vector Patch

Posted: Mon Nov 03, 2014 9:55 pm
by aport
Hello,

I picked up a KL25Z board and was super happy to see a ChibiOS port! Thanks for the hard work!

I wanted to talk to the MMA8451 accelerometer but I wasn't getting i2c interrupts. I looked in the driver and there was a handy-dandy FIXME. Attached is the patch that uses the correct vector depending on the Kinetis variant.

Thanks again!

edit: uhh... it's not letting me attach anything?!
edit2: Okay, I had to compress the file.

Re: Kinetis I2C0 Vector Patch

Posted: Mon Nov 03, 2014 10:44 pm
by utzig
Ah yes, I only tested the driver on the K20x I think :P

If everything looks right I'll apply it tomorrow. Btw, did you write any of the MMA code? I only wrote some basic reading of X/Y/Z values but not a "real" driver. Would be cool to add something more mature to the board demos that have this chip, for example, using a PWM driver each RGB LED could be mapped to one accel direction. Just an idea...

Thanks!

Re: Kinetis I2C0 Vector Patch

Posted: Tue Nov 04, 2014 12:19 am
by aport
Gluing the accelerometer output to PWM on the RGB LED is my goal! I wanted it to behave similarly to the default firmware that was on the board... the accelerometer modified the RGB and the touch sensor modified the duty cycle. I have the TSI up and running already.

Re: Kinetis I2C0 Vector Patch

Posted: Tue Nov 04, 2014 11:19 am
by utzig
Just applied the patch!

Gluing the accelerometer output to PWM on the RGB LED is my goal! I wanted it to behave similarly to the default firmware that was on the board... the accelerometer modified the RGB and the touch sensor modified the duty cycle.


Exactly what I had in mind!

I have the TSI up and running already.


Yay!

Re: Kinetis I2C0 Vector Patch

Posted: Tue Nov 04, 2014 6:25 pm
by aport
utzig wrote:Just applied the patch!


Thanks!

I have a question about code structure... I'm wondering where I should put the TSI driver. Right now it's sitting in my board directory, but since it's a peripheral of the MCU I'm thinking it should go somewhere else...

Is there a convention for non-standard HAL drivers? The TSI is straightforward to get up and running so I want to make a "real" ChibiOS style driver for it to sink my teeth into ChibiOS development.

Re: Kinetis I2C0 Vector Patch

Posted: Tue Nov 04, 2014 8:14 pm
by Giovanni
Hi,

If it is a kinetis-specific driver then it should go under /os/hal/ports/kinetis/...

A general driver would have to included in the portable HAL, that would be more complex because I am going to close version 3.0 and prepare for release.

Giovanni

Re: Kinetis I2C0 Vector Patch

Posted: Tue Nov 04, 2014 9:09 pm
by aport
Hi Giovanni,

Giovanni wrote:Hi,

If it is a kinetis-specific driver then it should go under /os/hal/ports/kinetis/...


I'll put it in the Kinetis HAL for now... I'm a good deal away from any additional contributions so far; I intend to do PWM, ICU, and GPT for the KL25Z as well.

A general driver would have to included in the portable HAL, that would be more complex because I am going to close version 3.0 and prepare for release.

Giovanni


As far as a general driver in the portable HAL, it might not be a bad idea to come up with an interface. I picked up four different eval boards at an IoT conference last week, and each one had capacitive touch buttons.

Freescale KL25Z
STM32L053
EnergyMicro / Silicon Labs EFM32
Atmel SAMA5

I'm taking a few weeks off work before the end of this year, and my intended projects are filling out the KL25Z HAL support and adding support for the STM32L053 (STM32L053-Discovery Cortex-M0+).
Once I get the STM32L053-Discovery up and running, I can take a look at a generic Capactive Touch driver?

If I have any time / brain cells left, I wanted to take a stab at a full platform port for the EFM32. I don't think these chips are very popular, but the eval board (Wonder Gecko) is super cool.


Thank you for creating an amazing project. You seriously rock.

Re: Kinetis I2C0 Vector Patch

Posted: Tue Nov 04, 2014 9:40 pm
by Giovanni
Of course you can :)

A well done driver would find a place for sure into the community repository "extended HAL", it will be like a staging area.

Giovanni