Hello friends, I have this question today. Observing the Kinetis K60 datasheet with I count (MK60DX256ZVLQ10), I can see that it have two pairs of pins with support for "I2C0" peripheral, that is:
pin 81: I2C0_SCL (ALT2)
pin 82: I2C0_SDA (ALT2)
pin 83: I2C0_SCL (ALT2)
pin 84: I2C0_SDA (ALT2)
I'm using MQX 3.8.1 with a customized board with the MCU descripted before. My question is very simple: Using MQX, with the BSP, formatted IO , and "fopen" function, how do I indicate to MQX which one of two pair of pins I will use?
This question can apply to SPI peripheral...
Solved! Go to Solution.
The mapping of internal MCU signals to MCU pins is BSP dependent. The source file name is init_gpio.c:
c:\Freescale\Freescale MQX 3.8\mqx\source\bsp\twrk60d100m\init_gpio.c
there is function _bsp_i2c_io_init() which is called by fopen() of an i2c io device.
so you have two options, either your way, but then I recommend to empty the _bsp_i2c_io_init(), so that you don't end up on the functions selected on both muxes. or you can modify the BSP init_gpio.c to meet your hardware.
Ok I have tried and I do the following:
Open the pins that I want to use as LWGPIO and set functionality to (2). Not set direction and initial value. This must be do before to open I2C peripheral.
This work fine.
Please let me know if this is the correct way to do this.
Thanks.
The mapping of internal MCU signals to MCU pins is BSP dependent. The source file name is init_gpio.c:
c:\Freescale\Freescale MQX 3.8\mqx\source\bsp\twrk60d100m\init_gpio.c
there is function _bsp_i2c_io_init() which is called by fopen() of an i2c io device.
so you have two options, either your way, but then I recommend to empty the _bsp_i2c_io_init(), so that you don't end up on the functions selected on both muxes. or you can modify the BSP init_gpio.c to meet your hardware.
Thanks for your answer Martin! That is the exact place were to find the definitions.
As remark, to the next releases, Freescale can put a "simple way" to define it... Using "user_config.h" for example:
#if (BSPCFG_ENABLE_I2C0 = 1)
#define I2C0_SDA_PIN PTD9
#define I2C0_SCL_PIN PTD8
#endif
Kind regards,