how to control a pca9685 with the frdmkl46z through the internal i2c component

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

how to control a pca9685 with the frdmkl46z through the internal i2c component

865 Views
judis_148
Contributor II

this my code 

WAIT1_Waitms(5);
fruit_SelectSlave(0x00);
fruit_SendChar(0x06);
WAIT1_Waitms(5);
fruit_SelectSlave(0x40);
dato[0]=0xFE;
dato[1]=110;
fruit_SendBlock(&dato,2,&ret);
WAIT1_Waitms(5);
dato[0]=0x00;
dato[1]=0x21;
fruit_SendBlock(&dato,2,&ret);
WAIT1_Waitms(5);

3 Replies

714 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Sharom Tovar,

   From the NXP side, we provide the i2c driver code.

  The I2C driver you can find it from the SDK:

Welcome | MCUXpresso SDK Builder 

  If you want to communicate with your pca9685 slave, you need to read the pca9685 datasheet, what the control command and data it needs.

  Then send the according data to the slave, if it still can't work, you can use the Logcal analyzer tool to check the I2C bus wave, whether the data is meet your slave demand.

  This is the normal thought for your reference.

Wish it helps you!

If you still have question about it, please kindly let me know.

Have a great day,
Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

714 Views
judis_148
Contributor II
thanks for your answer, I read the datasheet, it is a controller for servomotors, you can control up to 16 servomotors, but I do not understand how to select the address from kds of each output of pwm of the 16 available?
0 Kudos
Reply

714 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Sharom Tovar,

  I suggest you use the MCXPresso IDE instead of the KDS.

  KDS IDE is the old one, the MCUXresso IDE is the new IDE.

  About the I2C code, please refer to the SDK code which I recommend you, about the address, do you mean the slave I2C address?

  You can refer to FRDM0KL46 sdk code:

SDK_2.4.1_FRDM-KL46Z\boards\frdmkl46z\driver_examples\i2c\read_accel_value_transfer\iar

  This project is using the I2C to communicate with the external acceleration sensor.

  You can put the i2c slave address in masterXfer.slaveAddress;

Wish it helps you!

You can try it, and check the I2C bus data.

If you still have question about it, please kindly let me know.

 


Have a great day,
Kerry

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply