Too early EPDATA interrupt during an USB data transfer IN transaction with DMA

I am investigating a strange issue I have and it seems it's more present when softdevice is enabled, but maybe it's just a coincidence

I have a working design in place that is using dma transfer to send data to host using IN transaction and generally I get the USB interrupts in the following sequence 

- STARTED interrupt (pos=1)

- ENDEPIN2 interrupt (pos=4)

- EPDATA interrupt (pos=24)

But for no clear reason I sometimes and in rare occasion get the EPDATA interrupt too early. 

When it's occuring the design is "blocked" and I cannot go further.

So I have the following sequence:

- STARTED interrupt (pos=1)

- EPDATA interrupt (pos=24) ==> This one is occuring in same interrupt as the STARTED previous interrupt type.

- ENDEPIN2 interrupt (pos=4)

I tried to ignore the early EPDATA to try to respect the 1, 4, 24 interrupts sequence but it doesnt work.

Did anyone see this strange behavior ?

Parents
  • Hi,

     

    Hard to say without seeing a bit more context about what is running; however:

    Could it be that a higher priority interrupt is occurring, which makes both events to be triggered almost simultaneously in the application space?

    What SDK version are you using?

     

    Kind regards,

    Håkon

  • Hi,

    I am using softdevice 6.1.1 S140 version.

    I verified all the easydma programming sequences in the past (when it s working OK) and compared to failing case, I don't see anything weird and it seems the easydma transfer is done because the AMOUNT register in EPIN[2] section is = MAXCNT value. PTR register is positioned on the data to be sent.

    I checked doing a Wireshark trace in parallel and I can see that the easydma data is NOT seen on host side but all previous ones are.

    I am lucky I have a lauterbach trace box to make accurate trace of PC counter and I am seeing that in failing case I have the SWI2_EGU2_IRQHandler occuring just before the STARTED event USBD IRQ handler, I dont know if it could generate problems but I am observing this difference here.

    In the same USBD IRQ handler I see the STARTED and EPDATA events raised at same time when entering in interrupt code. Then I get the USBD ENDEPIN interrupt some 10/20us later. The SWI2 EGU2 interrupt occured due to BLE events (I am doing scan of advertising devices in parallel of USB transfers).

    Is there some care to be done between USBD programming and BLE events or shall it work without side effects ? 

  • Hi,

     

    DaviT said:
    I am using softdevice 6.1.1 S140 version.

    nRF5 SDK v15.3.0?

    DaviT said:

    I verified all the easydma programming sequences in the past (when it s working OK) and compared to failing case, I don't see anything weird and it seems the easydma transfer is done because the AMOUNT register in EPIN[2] section is = MAXCNT value. PTR register is positioned on the data to be sent.

    I checked doing a Wireshark trace in parallel and I can see that the easydma data is NOT seen on host side but all previous ones are.

    Could you share the log?

    DaviT said:
    I am lucky I have a lauterbach trace box to make accurate trace of PC counter and I am seeing that in failing case I have the SWI2_EGU2_IRQHandler occuring just before the STARTED event USBD IRQ handler, I dont know if it could generate problems but I am observing this difference here.

    SWI2 is the SoftDevice handler for the application side.

    What is the IRQ priority for the USBD interrupt? this is in your sdk_config.h::NRFX_USBD_CONFIG_IRQ_PRIORITY

    Have you tried to change this to a higher priority?

    Here's the levels available for the application when running S140: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsds_s140%2FSDS%2Fs1xx%2Fprocessor_avail_interrupt_latency%2Fexception_mgmt_sd.html&cp=5_7_4_0_15_1

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    DaviT said:
    I am using softdevice 6.1.1 S140 version.

    nRF5 SDK v15.3.0?

    DaviT said:

    I verified all the easydma programming sequences in the past (when it s working OK) and compared to failing case, I don't see anything weird and it seems the easydma transfer is done because the AMOUNT register in EPIN[2] section is = MAXCNT value. PTR register is positioned on the data to be sent.

    I checked doing a Wireshark trace in parallel and I can see that the easydma data is NOT seen on host side but all previous ones are.

    Could you share the log?

    DaviT said:
    I am lucky I have a lauterbach trace box to make accurate trace of PC counter and I am seeing that in failing case I have the SWI2_EGU2_IRQHandler occuring just before the STARTED event USBD IRQ handler, I dont know if it could generate problems but I am observing this difference here.

    SWI2 is the SoftDevice handler for the application side.

    What is the IRQ priority for the USBD interrupt? this is in your sdk_config.h::NRFX_USBD_CONFIG_IRQ_PRIORITY

    Have you tried to change this to a higher priority?

    Here's the levels available for the application when running S140: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsds_s140%2FSDS%2Fs1xx%2Fprocessor_avail_interrupt_latency%2Fexception_mgmt_sd.html&cp=5_7_4_0_15_1

     

    Kind regards,

    Håkon

Children
No Data
Related