Problem with CDC ACM multiple transfers in one interrupt

I created a protocol for packets through CDC ACM, and I send multiple packets if the length goes above 64 bytes. Sometimes I send "request" packets that are received by the nrf52840, so the nrf52840 will receive like 12 requests for data at a time, so I have 12 irq_tx_enable rounds where it sends queued data from a ringbuffer, all in the same interrupt. However, if I don't put an artificial delay between request packets, it fails to send all 12. It will silently fail at around the 5th and move on. Is there an elegant solution to this, without a separate thread to make sure irq_tx_enable happens slowly?

Parents
  • Hello,

    It's not entirely clear if these are IN or OUT transactions, but it should be explained how this should be handled in the USBD peripheral:
    https://infocenter.nordicsemi.com/topic/ps_nrf52840/usbd.html 

    For instance I can find Events it says:

    "Events ENDEPIN[n], ENDEPOUT[n] (n=0..7), ENDISOIN, and ENDISOOUT events indicate that the entire buffer has been consumed. The buffer can be accessed safely by the software.

    Only a single EasyDMA transfer can take place in USBD at any time. Software must ensure that tasks STARTEPIN[n] (n=0..7), STARTISOIN , STARTEPOUT[n] (n=0..7), or STARTISOOUT are not triggered before events ENDEPIN[n] (n=0..7), ENDISOIN, ENDEPOUT[n] (n=0..7), or ENDISOOUT are received from an on-going transfer."

    All that said, I am not sure how low level you are working here, but I would assume these details were abstraced away if you were using the driver / library.

    Best regards,
    Kenneth

Reply
  • Hello,

    It's not entirely clear if these are IN or OUT transactions, but it should be explained how this should be handled in the USBD peripheral:
    https://infocenter.nordicsemi.com/topic/ps_nrf52840/usbd.html 

    For instance I can find Events it says:

    "Events ENDEPIN[n], ENDEPOUT[n] (n=0..7), ENDISOIN, and ENDISOOUT events indicate that the entire buffer has been consumed. The buffer can be accessed safely by the software.

    Only a single EasyDMA transfer can take place in USBD at any time. Software must ensure that tasks STARTEPIN[n] (n=0..7), STARTISOIN , STARTEPOUT[n] (n=0..7), or STARTISOOUT are not triggered before events ENDEPIN[n] (n=0..7), ENDISOIN, ENDEPOUT[n] (n=0..7), or ENDISOOUT are received from an on-going transfer."

    All that said, I am not sure how low level you are working here, but I would assume these details were abstraced away if you were using the driver / library.

    Best regards,
    Kenneth

Children
Related