Kinetis I2C0 Vector Patch

ChibiOS public support forum for topics related to the Freescale Kinetis family of micro-controllers.

Moderator: utzig

aport
Posts: 36
Joined: Sat May 10, 2014 7:35 pm
Has thanked: 2 times
Been thanked: 4 times

Kinetis I2C0 Vector Patch

Postby aport » Mon Nov 03, 2014 9:55 pm

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.
Attachments
kinetis-i2c.patch.zip
i2c0 vector patch
(614 Bytes) Downloaded 420 times

utzig
Posts: 359
Joined: Sat Jan 07, 2012 6:22 pm
Location: Brazil
Has thanked: 1 time
Been thanked: 20 times
Contact:

Re: Kinetis I2C0 Vector Patch

Postby utzig » Mon Nov 03, 2014 10:44 pm

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!

aport
Posts: 36
Joined: Sat May 10, 2014 7:35 pm
Has thanked: 2 times
Been thanked: 4 times

Re: Kinetis I2C0 Vector Patch

Postby aport » Tue Nov 04, 2014 12:19 am

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.

utzig
Posts: 359
Joined: Sat Jan 07, 2012 6:22 pm
Location: Brazil
Has thanked: 1 time
Been thanked: 20 times
Contact:

Re: Kinetis I2C0 Vector Patch

Postby utzig » Tue Nov 04, 2014 11:19 am

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!

aport
Posts: 36
Joined: Sat May 10, 2014 7:35 pm
Has thanked: 2 times
Been thanked: 4 times

Re: Kinetis I2C0 Vector Patch

Postby aport » Tue Nov 04, 2014 6:25 pm

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.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Kinetis I2C0 Vector Patch

Postby Giovanni » Tue Nov 04, 2014 8:14 pm

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

aport
Posts: 36
Joined: Sat May 10, 2014 7:35 pm
Has thanked: 2 times
Been thanked: 4 times

Re: Kinetis I2C0 Vector Patch

Postby aport » Tue Nov 04, 2014 9:09 pm

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.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Kinetis I2C0 Vector Patch

Postby Giovanni » Tue Nov 04, 2014 9:40 pm

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


Return to “Kinetis Support”

Who is online

Users browsing this forum: No registered users and 20 guests