I am currently using a Teensy 3.6 with a K66 micro controller chip to do basic I2C operations. In setting up the start signal to the slave, I am setting up the I2C0_C1 register with some predefined constants such as 'I2C_C1_IICEN_MASK'.
Here's a snippet of my code.
I2C0_C1 |= I2C_C1_IICEN_MASK; // Enable
I2C
I2C0_C1 |= I2C_C1_TX_MASK; // TX mode
I2C0_C1 |= I2C_C1_MST_MASK; // Start signal
When running this in the Arduino 1.8.5 IDE I get the following error.
"error: 'I2C_C1_IICEN_MASK' was not declared in this scope"
It seems that many other projects use 'I2C_C1_IICEN_MASK' definition, but I am not sure which library defines this variable. Is this something I need to define myself? I can do the bitwise masking myself, but it seemed better practice to use the conventions others are using. Thanks again, if someone could tell me where 'I2C_C1_IICEN_MASK' is defined or how to find, that would be great. Thanks!
Hi Carlos Pereyra,
Thank you for your interest in NXP Semiconductor products and the opportunity to serve you.
I'm not familiar with the Arduino 1.8.5 IDE, but for KEIL, IAR, CW, etc, it exists header file folder under these IDEs' installation directory.
In the header file, it would declare variety kinds of masks, of course, includes I2C_C1_MST_MASK.
So please check it.
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi jeremyzhou,
Do you know the name of the header file that contains I2C_C1_MST_MASK? So I can possibly try to import.
Thanks again
Carlos
Take a look at the open source uTasker project on Github. It supports the Teensy 3.6 and so allows developments for it to be done in various other IDEs as well as adding features not available in the Arduino environment (such as composite USB, USB-MSD, RNDIS with TCP/IP stack or HS USB). It is quite popular for adding a serial loader (from SD card or USB-MSD) to the Teensy 3.6 as well.
You may be able to use its I2C driver: http://www.utasker.com/docs/uTasker/uTasker_I2C.pdf
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
Kinetis K66:
- http://www.utasker.com/kinetis/TWR-K65F180M.html
- http://www.utasker.com/kinetis/FRDM-K66F.html
- http://www.utasker.com/kinetis/TEENSY_3.6.html
For less questions and restrictions, and faster, cheaper developments: try uTasker for Kinetis