<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Kinetis MicrocontrollersのトピックRe: How to enable interrupts for a I2C eDMA transaction</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-interrupts-for-a-I2C-eDMA-transaction/m-p/882545#M52335</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The new SDK 2.5 version is already available. I will suggest to check it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I note that you're selecting the same source for more than one source. I will suggest to only link a DMA channel to his respective source. Linking more than one channel to a single source could cause errors in your implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Alexis Andalon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 26 Mar 2019 22:15:04 GMT</pubDate>
    <dc:creator>Alexis_A</dc:creator>
    <dc:date>2019-03-26T22:15:04Z</dc:date>
    <item>
      <title>How to enable interrupts for a I2C eDMA transaction</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-interrupts-for-a-I2C-eDMA-transaction/m-p/882542#M52332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using an MKL28Z512XXX7 processor.&lt;/P&gt;&lt;P&gt;I have SDK 2.2.&lt;/P&gt;&lt;P&gt;I'm trying to use DMA to send messages out LpI2C2 (transmit only).&lt;/P&gt;&lt;P&gt;With a logic analyzer connected to SCK and SDA, I see that the I2C message is sent.&lt;/P&gt;&lt;P&gt;My problem is that I do not get the callback for my transaction.&lt;/P&gt;&lt;P&gt;Through investigation, I've found that no interrupt fires after the completion of the DMA transfer (at least I can find no signs of an interrupt)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I followed the example in lpi2c_edma_transfer.c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Importantly, after transmission occurs (seen on the logic analyzer), I stop the processor and inspect the DMA0_INT register, I see a value of 1 which, to me, indicates that the DMA transfer is complete. I would expect an interrupt to occur since my DMAx_TCDn_CSR register has a value of 0x8a which indicates that the transfer is done and since INTMAJOR is set, I would expect an interrupt.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I call LPI2C_MasterTransferEDMA twice, the second call returns the "BUSY" error code. This is further evidence that I never get the transmit complete interrupt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you offer any advice on how to debug this? Why do I not see interrupts? Which interrupt handler might you expect to be called? LPI2C2_DriverIRQHandler? DMA0_xx_DriverIRQHandler? INTMUX0_x_DriverIRQHandler?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been at this for a while so my code includes a lot to "ideas", but none seem helpful. That said, here's the initialization code, feel free to point out where I've gone wrong:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;CLOCK_EnableClock(kCLOCK_Lpi2c2); 
LPI2C_MasterGetDefaultConfig(&amp;amp;ledI2cConfig); 
ledI2cConfig.baudRate_Hz = WSNINIT_LED_I2C_BAUD_RATE; 
/* Initialize the LPI2C master peripheral */ 
LPI2C_MasterInit(((LPI2C_Type *)LPI2C2_BASE), &amp;amp;ledI2cConfig, CLOCK_GetIpFreq(kCLOCK_Lpi2c2));
// LPI2C_MasterInit(((LPI2C_Type *)LPI2C2_BASE), &amp;amp;ledI2cConfig, CLOCK_GetFreq(kCLOCK_BusClk));
// CLOCK_EnableClock(kCLOCK_Dma0); 
// CLOCK_EnableClock(kCLOCK_Intmux0); 
// NVIC_SetPriority(DMA0_04_IRQn, 2); 
INTMUX_Init(INTMUX0); 
// INTMUX_SetChannelMode(INTMUX0, 0, kINTMUX_ChannelLogicOR); 
// INTMUX_SetChannelMode(INTMUX0, 1, kINTMUX_ChannelLogicOR); 
// INTMUX_SetChannelMode(INTMUX0, 2, kINTMUX_ChannelLogicOR); 
// INTMUX_SetChannelMode(INTMUX0, 3, kINTMUX_ChannelLogicOR); 
// INTMUX_EnableInterrupt(INTMUX0, 1, DMA0_26_IRQn); 
// INTMUX_EnableInterrupt(INTMUX0, 1, DMA0_37_IRQn); 
INTMUX_EnableInterrupt(INTMUX0, 0, LPI2C2_IRQn); 
// INTMUX_EnableInterrupt(INTMUX0, 1, LPI2C2_IRQn); 
// INTMUX_EnableInterrupt(INTMUX0, 2, LPI2C2_IRQn); 
// INTMUX_EnableInterrupt(INTMUX0, 3, LPI2C2_IRQn); 
for (uint8_t ich = 0; ich &amp;lt; 4; ich++) { 
  for (uint8_t intr = 32; intr &amp;lt; 64; intr++) { 
    INTMUX_EnableInterrupt(INTMUX0, ich, intr); 
  } 
} 
// /* DMAMux init and EDMA init */ 
DMAMUX_Init(DMAMUX0); 
DMAMUX_SetSource(DMAMUX0, 0U, (uint8_t)kDmaRequestMux0LPI2C2Tx); 
DMAMUX_EnableChannel(DMAMUX0, 0); 
DMAMUX_SetSource(DMAMUX0, 1U, (uint8_t)kDmaRequestMux0LPI2C2Tx); 
DMAMUX_SetSource(DMAMUX0, 2U, (uint8_t)kDmaRequestMux0LPI2C2Tx); 
DMAMUX_SetSource(DMAMUX0, 3U, (uint8_t)kDmaRequestMux0LPI2C2Tx); 
DMAMUX_SetSource(DMAMUX0, 4U, (uint8_t)kDmaRequestMux0LPI2C2Tx); 
DMAMUX_SetSource(DMAMUX0, 5U, (uint8_t)kDmaRequestMux0LPI2C2Tx); 
DMAMUX_SetSource(DMAMUX0, 6U, (uint8_t)kDmaRequestMux0LPI2C2Tx); 
DMAMUX_SetSource(DMAMUX0, 7U, (uint8_t)kDmaRequestMux0LPI2C2Tx); 
DMAMUX_EnableChannel(DMAMUX0, 1); 
DMAMUX_EnableChannel(DMAMUX0, 2); 
DMAMUX_EnableChannel(DMAMUX0, 3); 
DMAMUX_EnableChannel(DMAMUX0, 4); 
DMAMUX_EnableChannel(DMAMUX0, 5); 
DMAMUX_EnableChannel(DMAMUX0, 6); 
DMAMUX_EnableChannel(DMAMUX0, 7); 
EDMA_GetDefaultConfig(&amp;amp;ledEdmaConfig); 
EDMA_Init(DMA0, &amp;amp;ledEdmaConfig); 
/* Create the EDMA channel handles */ 
EDMA_CreateHandle(&amp;amp;ledEdmaRxHandle, DMA0, 7); 
EDMA_CreateHandle(&amp;amp;ledEdmaTxHandle, DMA0, 0); 
EnableIRQ(LPI2C2_IRQn); 
CLOCK_SetIpSrc(kCLOCK_Lpi2c2, kCLOCK_IpSrcSircAsync); /
* Create the LPI2C master DMA driver handle */ 
LPI2C_MasterCreateEDMAHandle(((LPI2C_Type *)LPI2C2_BASE), &amp;amp;ledEdmaMasterHandle, &amp;amp;ledEdmaRxHandle, &amp;amp;ledEdmaTxHandle, &amp;amp;UiTaskFactory_LedCallback, NULL); 
// LPI2C_MasterCreateEDMAHandle(((LPI2C_Type *)LPI2C2_BASE), &amp;amp;ledEdmaMasterHandle, NULL, &amp;amp;ledEdmaTxHandle, &amp;amp;UiTaskFactory_LedCallback, NULL); 
// LPI2C_MasterEnableInterrupts(((LPI2C_Type *)LPI2C2_BASE), 0x1U); &lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I have this code to send a message:&lt;/P&gt;&lt;PRE&gt;ledTransfer.slaveAddress = ISSIDRIVER_I2C_SLAVE_ADDRESS; 
ledTransfer.direction = kLPI2C_Write; 
ledTransfer.subaddress = 0; 
ledTransfer.subaddressSize = 0; 
ledTransfer.data = message; 
ledTransfer.dataSize = length; 
ledTransfer.flags = kLPI2C_TransferDefaultFlag; 
/* Send master non-blocking data to slave */ 
status_t reVal = LPI2C_MasterTransferEDMA((LPI2C_Type *)LPI2C2_BASE, &amp;amp;ledEdmaMasterHandle, &amp;amp;ledTransfer); 
if (reVal != kStatus_Success) { while (1); }&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Mar 2019 17:26:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-interrupts-for-a-I2C-eDMA-transaction/m-p/882542#M52332</guid>
      <dc:creator>chrisdetka</dc:creator>
      <dc:date>2019-03-23T17:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable interrupts for a I2C eDMA transaction</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-interrupts-for-a-I2C-eDMA-transaction/m-p/882543#M52333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It sounds like you have missed enabling the DMA channel's interrupt in the NVIC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect&lt;/P&gt;&lt;PRE&gt;EnableIRQ(LPI2C2_IRQn);&lt;/PRE&gt;&lt;P&gt;is intended enabling the interrupt for the LPI2C2, but I don't now whether works in the KSD library since this is an interrupt uses the INTMUX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Quite certainly however you need an interrupt from DMA0 so it may just be missing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;EnableIRQ(DMA0_IRQn);&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Therefore you'll be interested in the DMA channel handler.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get further background details about the MUX interrupt (potentially also needed by your LPI2C) in this video: &lt;A href="https://www.youtube.com/watch?v=zKa5BoOhBrg" rel="nofollow noopener noreferrer" target="test_blank"&gt;https://www.youtube.com/watch?v=zKa5BoOhBrg&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;Complete KL28 solutions, training and support:&lt;A href="http://www.utasker.com/kinetis.html" target="_blank"&gt;http://www.utasker.com/kinetis.html&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;- &lt;A href="http://www.utasker.com/kinetis/FRDM-KL28Z.html" rel="nofollow noopener noreferrer" target="test_blank"&gt;http://www.utasker.com/kinetis/FRDM-KL28Z.html&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For solutions, rather than just examples: &lt;A href="https://github.com/uTasker/uTasker-Kinetis" rel="nofollow noopener noreferrer" target="test_blank"&gt;https://github.com/uTasker/uTasker-Kinetis&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Mar 2019 20:03:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-interrupts-for-a-I2C-eDMA-transaction/m-p/882543#M52333</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2019-03-23T20:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable interrupts for a I2C eDMA transaction</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-interrupts-for-a-I2C-eDMA-transaction/m-p/882544#M52334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your comments, Mark. I believe your feedback is bringing me closer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Still not getting the interrupt to conclude the DMA transfer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here are more details that you or others might use to guide me further. After an attempted transaction, I pause execution and inspect registers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The NVIC ISER register has the value 0xF020E003&amp;nbsp;&lt;/P&gt;&lt;P&gt;- DMA0_04 and DMA0_15 are enabled&lt;/P&gt;&lt;P&gt;- All four INTMUX channels are enabled&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The NVIC ISPR register has the value 0xF0000002&lt;/P&gt;&lt;P&gt;- All INTMUX channels have pending interrupts&lt;/P&gt;&lt;P&gt;- DMA0_15 has a pending interrupt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The LPI2C2 registers have these values:&lt;/P&gt;&lt;P&gt;- MIER = 0x3E03 &amp;lt;- Transmit and Receive interrupt enabled&lt;/P&gt;&lt;P&gt;NOTE: I modified the fsl_lpi2c_edma.c driver file to enable LPI2C interrupts when starting a transfer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The INTMUX registers have these values:&lt;/P&gt;&lt;P&gt;- CHn_CSR = 0x80000000 &amp;lt;- Interrupt pending (this value appears on channel 0 and 1)&lt;/P&gt;&lt;P&gt;- CHn_IER_31_2 = 0xFFFFFFFF &amp;lt;- I got carried away and enabled all interrupts&lt;/P&gt;&lt;P&gt;- CHn_IPR_31_2 = 0x80&amp;nbsp; &amp;lt;- That's the LPI2C2 interrupt!&lt;/P&gt;&lt;P&gt;- CHn_Vec = 0xDC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The DMA registers are as follows:&lt;/P&gt;&lt;P&gt;- INT = 0x02 &amp;lt;- Interrupt requested on channel 1 (that's the I2C Tx channel that I'm using)&lt;/P&gt;&lt;P&gt;- TCD[1].CSR = 0x8A &amp;lt;- INTMAJOR is enabled and the channel is done&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The DMAMUX has these register values:&lt;/P&gt;&lt;P&gt;CHCFG[0] = 0x8d&amp;nbsp; &amp;nbsp;&amp;lt;- LPI2C2Rx&lt;/P&gt;&lt;P&gt;CHCFG[1] = 0x8e&amp;nbsp; &amp;nbsp;&amp;lt;- LPI2C2Tx&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based upon my reading of the SDK 2.2 code, I am expecting the EDMA_HandleIRQ to be called. This function maps to DMA0_15_IRQHandler. All indication is that the ISR should be called, but it is not.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you (or anyone reading) suggest why I'm missing this interrupt?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much,&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Mar 2019 15:59:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-interrupts-for-a-I2C-eDMA-transaction/m-p/882544#M52334</guid>
      <dc:creator>chrisdetka</dc:creator>
      <dc:date>2019-03-26T15:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable interrupts for a I2C eDMA transaction</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-interrupts-for-a-I2C-eDMA-transaction/m-p/882545#M52335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The new SDK 2.5 version is already available. I will suggest to check it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I note that you're selecting the same source for more than one source. I will suggest to only link a DMA channel to his respective source. Linking more than one channel to a single source could cause errors in your implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Alexis Andalon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Mar 2019 22:15:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-interrupts-for-a-I2C-eDMA-transaction/m-p/882545#M52335</guid>
      <dc:creator>Alexis_A</dc:creator>
      <dc:date>2019-03-26T22:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to enable interrupts for a I2C eDMA transaction</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-interrupts-for-a-I2C-eDMA-transaction/m-p/882546#M52336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all. Thank you Alexis and Mark for your time and thoughtful answers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was able to get the I2C DMA working on my system. The problem, I'm&amp;nbsp;embarrassed to say, was that the processor had been configured to globally disable interrupts. When I corrected this configuration, things started working as expected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry to have troubled you with such a silly oversight.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2019 21:06:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-enable-interrupts-for-a-I2C-eDMA-transaction/m-p/882546#M52336</guid>
      <dc:creator>chrisdetka</dc:creator>
      <dc:date>2019-03-27T21:06:01Z</dc:date>
    </item>
  </channel>
</rss>

