i2c_interrupt_transfer

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

i2c_interrupt_transfer

765 Views
sagonzal
Contributor III

Sorry to bother but the example "i2c_interrupt_transfer.c" is not working on my K22FN1M0 on a custom board. I believe now, that the problem is not in the example itself, but rather than the KDS.

 

I've tracked down the problem to the function in the KDS on file "fsl_i2c.c" and the function I2C_MasterTransferCreateHandle:

 

 

    void I2C_MasterTransferCreateHandle(I2C_Type *base,

                                        i2c_master_handle_t *handle,

                                        i2c_master_transfer_callback_t callback,

                                        void *userData)

    {

        assert(handle);

 

        uint32_t instance = I2C_GetInstance(base);

 

        /* Zero handle. */

        memset(handle, 0, sizeof(*handle));

 

        /* Set callback and userData. */

        handle->completionCallback = callback;

        handle->userData = userData;

 

        /* Save the context in global variables to support the double weak mechanism. */

        s_i2cHandle[instance] = handle;

 

        /* Save master interrupt handler. */

        s_i2cMasterIsr = I2C_MasterTransferHandleIRQ;

 

        /* Enable NVIC interrupt. */

        EnableIRQ(s_i2cIrqs[instance]);

    }

   

there, the instance is 0 and the irq is set, but the, with the following equate, I don't think is working at all:

 

    s_i2cMasterIsr = I2C_MasterTransferHandleIRQ;

 

...since the handle is never called!.

 

 

The problem is that "I2C_TransferCommonIRQHandler" is never called and so, no handler is available for the interrupt and the code, oboiusly, ends in:

 

    // handler is not present in the application code.

    void __attribute__ ((section(".after_vectors")))

    Default_Handler(void)

    {

      while (1)

        {

        }

    }

 

Other examples work for me and the I2C interrupt is working in another custom work so no problems there. My development system is on windows eclipse and GCC with GNU Tools ARM Embedded (4.8 2014q2) and also tested on a more modern 5.2 2015q4 and GDB 7.1.

Labels (1)
0 Kudos
2 Replies

453 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi ,

Would you please specify the KSDK version that you are using? Thanks for your patience!


Have a great day,
Kan

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

0 Kudos

453 Views
sagonzal
Contributor III

Hi kan:

The example "i2c_interrupt_transfer"  is in

"Kinetis SDK\SDK_2.0_MK22FN1M0xxx12.zip\boards\twrk21f120m\driver_examples\i2c\interrupt_transfer\i2c_interrupt_transfer.c"

Hope you can help us...

warmes regards.

0 Kudos