KL46Z with FXS-9AXIS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

KL46Z with FXS-9AXIS

865 Views
bertan7
Contributor I

Hey i'm using the KL46Z working with KDS and already write some programs ( Hello World, LED blink, UART etc.) and it works well.

I need the FXS-9Axis for my new project now (Selfbalancing Robot) to get the Data from the Acc and Gyro on the 9Axis and calculate them to use the Kalmanfilter and adjust later with a PID controller.

My Problem:

I don't know how to use the i2c comunication to get output values from the Gyro or Acc, on my Term to see if it works

Thanks

Labels (1)
0 Kudos
7 Replies

558 Views
bertan7
Contributor I

Hey Thanks for your advice,

I installed the library and imported the FSFK_KL46Z in KDS but it does not work. I cannot debug it

It can not find the Cpu.h

The coonsole says: FSFK_KL25.elf: cannot execute binary file: error in the format of the program file

Would be great if you can help me

Thank you

0 Kudos

558 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Bertan,

  The KL46 sample code is the Codewarrior project, so you can't use the KDS to open it directly.

    When you import it, did you refer to the KDS import document in the path:C:\Freescale\KDS_3.0.0\doc KDS_Porting_Guide?

  Besides, I use the Codewarrior 10.6 to open the KL46project, and complier it, it has no error.

44.jpg

  So, you can download an CW to open it, then refer to the codewarrior configuration to configure your KDS again.

Wish it helps you!


Have a great day,

Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

558 Views
bertan7
Contributor I

Hey Thanks for your answer,

but i need something with i2c mastersendblock and masterreceiveblock in the code because of the processor expert component: I2C.

Are there any other example codes for ACC(FXOS8700CQ) or GYRO(FXAS21000) for the FRDM-FXS-9Axis that i can use?

0 Kudos

558 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Bertan,

Please downloader the library for FRDM-FXS-9Axis:

NXP Sensor Fusion Library for Kinetis MCUs

After you install it, you can find the KL46 code for FRDM-FXS-9XIS in folder:FRDM-FXS-9AXIS\Codewarrior\FSFK_KL46Z

Wish it helps you!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

558 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Bertan,

      You need to find the I2C driver at first, actually, our FRDM-KL46 have the I2C code for reading the digital accelerometer, you can refer to it, then associate with the FXS-9AXIS datasheet to modify the code and read your FXS-9AXIS data ,.

    The sample code download link:

http://cache.nxp.com/files/32bit/software/KL46_SC.exe?fpsp=1&WT_TYPE=Lab%20and%20Test%20Software&WT_...

    Then, you can find the according code in folder: kinetis_kl46_sc\kinetis_kl46_sc_rev2\klxx-sc-baremetal\build\iar\FRDMKL46_Demo

Wish it helps you!

If you still have question, please contact with me!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

558 Views
bertan7
Contributor I

Hey Thank you for your answer,

but I can't find the code in the link for reading the accelerometer.

There is just a main.c file with: int main() and return(). in it

But I already have a demo called Bubble where I can send out the acc data

Now I need the code for reading the gyro on the 9-axis, to add it to the accelerometer data

Do I just have to change the PINs and addresses?

0 Kudos

558 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Bertan,

    Please see this picture:

36.jpg

    That's the accelerator code.

    About whether you need to change the PINS and address, it determined by your hardware, you should choose the according pin which your sensor are using, the address you should read your sensor's datasheet.

  I don't have the 9-axis code directly, you need to write the code by yourself and refer to the accelerator code.

Wish it helps you!


Have a great day,
Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos