USB NYET response despite of free buffer (LPC55S69 USB1 HS Controller)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

USB NYET response despite of free buffer (LPC55S69 USB1 HS Controller)

580件の閲覧回数
pettel
Contributor II

I'm using EP2 OUT with double buffering.

  • Buf0 and Buf1 have 2048 bytes each
  • EP2 OUT is a bulk endpoint with a maximum packet size of 512 bytes

Both endpoints (EP2_OUT_BUF0, EP2_OUT_BUF1) are initialized with 2048 N-bytes and the endpoints are set to active.

Expectation: without further interaction 4096 bytes should be received, without a NYET response.

 

Observed behaviour: after Buf0 is full a NYET response is transmitted instead of an ACK response, despite Buf1 beeing completely empty and active.

Bild 2025-10-07 at 01.17.49.png

This behaviour is especially detrimental to performance if you work with 512 byte buffers for Buf0 and Buf1, because in this case a NYET response is transmitted after every OUT transmission from the host, which requires an unnecessary USB-Ping and reduces throughput.

Is there a workaround or is this a hardware bug?

  

タグ(2)
0 件の賞賛
返信
4 返答(返信)

486件の閲覧回数
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @pettel,

This is by design of the USB stack implementation of the SDK. As you can see on a comment on "PERI_USBHSD.h": 

DATA_PENDING - As long as this bit is set to one and LPM supported bit is set to one, HW will
* return a NYET handshake on every LPM token it receives. If LPM supported bit is set to one and
* this bit is zero, HW will return an ACK handshake on every LPM token it receives. If SW has
* still data pending and LPM is supported, it must set this bit to 1.

 

0 件の賞賛
返信

456件の閲覧回数
pettel
Contributor II

Hi @EdwinHz ,

 

this topic is not about LPM tokens. It's about sending user data from the USB host to EP2 of the LPC55S69. Link Power Management and the associated transactions are a completely separate topic.

0 件の賞賛
返信

81件の閲覧回数
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @pettel,

At high speed, bulk OUT endpoints use the PING/NYET mechanism in the following manner:

If the device ACKs, the host may immediately send another payload. However, if the device NYETs, the host must PING before sending the next data packet. With two endpoint banks, hardware is supposed to ACK as long as at least one bank remains available and primed.

On LPC55S6x USB1 HS device (IP3511HS), the “double buffer” is software‑managed. The SDK and reference designs keep track of which bank is “in use” and which is ready using software toggles. The next bank is not automatically considered “ready for the next payload” just because it’s empty, you must prime/validate it, and the hardware’s EPINUSE/EPTOGGLE needs to reflect that before the host’s next transaction. If the bank isn’t armed in time, the device will finish the current packet and return NYET.

BR,
Edwin.

0 件の賞賛
返信

59件の閲覧回数
pettel
Contributor II

Hi Edwin,

thank you for the prompt response!

I am fully aware of the NYET/PING mechanism and I know, that if the next buffer in not initialized properly, the device will respond to the host with a NYET.

To be more precise in the original post, I should have written "both endpoint out buffers...".

I would like to know, if you would agree, that if you have both buffers (2048 bytes for each buffer, 512 bytes per BULK packet) completely activated/primed for the transfer, before the  BULK OUT transfer starts, then at least 8 BULK OUT packets should be able to be sent from the host to the device without receiving a NYET response.

But in reality in this scenario, I get a NYET response already after 4 BULK OUT packets, even if both buffers are completely primed for the transfer. The initialization code for both buffers is triggered by the control transfer that is visible in the screenshot from the USB analyzer in the original post.

Do you have a test firmware for USB HS performance, that does nothing but reinitializing a buffer after the transfer in this buffer is completed?

I did not use any part of CMSIS or the SDK libraries. Instead I wrote my own HAL and USB stack from scratch in Zig.

The code, which is triggered by the control transfer before the EP2 OUT transfer is started, looks like this:

```zig
...
ep2.out.initEpBuffer0();
ep2.out.initEpBuffer1();
...
```

EP2 OUT Module code for initializing the buffers:

```zig
pub fn initEpBuffer0() void {
EndPoint.ep_cmd_stat_list.ep2_out_buf_0.buffer_address_offset = EndPoint.ep_cmd_stat_address_offset_ep2_out_buf0;
EndPoint.ep_cmd_stat_list.ep2_out_buf_0.buffer_nbytes = config.LinkerConfig.usb_hs_ep2_out_buffer_size;
EndPoint.ep_cmd_stat_list.ep2_out_buf_0.active = .buffer_active;
}

pub fn initEpBuffer1() void {
EndPoint.ep_cmd_stat_list.ep2_out_buf_1.buffer_address_offset = EndPoint.ep_cmd_stat_address_offset_ep2_out_buf1;
EndPoint.ep_cmd_stat_list.ep2_out_buf_1.buffer_nbytes = config.LinkerConfig.usb_hs_ep2_out_buffer_size;
EndPoint.ep_cmd_stat_list.ep2_out_buf_1.active = .buffer_active;
}
```

Looking forward to your feedback!

タグ(4)
0 件の賞賛
返信
%3CLINGO-SUB%20id%3D%22lingo-sub-2181199%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E7%A9%BA%E3%81%8D%E3%83%90%E3%83%83%E3%83%95%E3%82%A1%E3%81%8C%E3%81%82%E3%82%8B%E3%81%AB%E3%82%82%E3%81%8B%E3%81%8B%E3%82%8F%E3%82%89%E3%81%9AUSB%20NYET%E5%BF%9C%E7%AD%94%EF%BC%88LPC55S69%20USB1%20HS%E3%82%B3%E3%83%B3%E3%83%88%E3%83%AD%E3%83%BC%E3%83%A9%EF%BC%89%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2181199%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E3%83%80%E3%83%96%E3%83%AB%E3%83%90%E3%83%83%E3%83%95%E3%82%A1%E3%83%AA%E3%83%B3%E3%82%B0%E3%81%A7%20EP2%20OUT%20%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3CUL%3E%3CLI%3EBuf0%E3%81%A8Buf1%E3%81%AF%E3%81%9D%E3%82%8C%E3%81%9E%E3%82%8C2048%E3%83%90%E3%82%A4%E3%83%88%E3%81%A7%E3%81%99%3C%2FLI%3E%3CLI%3EEP2%20OUT%E3%81%AF%E6%9C%80%E5%A4%A7%E3%83%91%E3%82%B1%E3%83%83%E3%83%88%E3%82%B5%E3%82%A4%E3%82%BA%E3%81%8C512%E3%83%90%E3%82%A4%E3%83%88%E3%81%AE%E3%83%90%E3%83%AB%E3%82%AF%E3%82%A8%E3%83%B3%E3%83%89%E3%83%9D%E3%82%A4%E3%83%B3%E3%83%88%E3%81%A7%E3%81%99%E3%80%82%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%E4%B8%A1%E6%96%B9%E3%81%AE%E3%82%A8%E3%83%B3%E3%83%89%E3%83%9D%E3%82%A4%E3%83%B3%E3%83%88%20(EP2_OUT_BUF0%E3%80%81EP2_OUT_BUF1)%20%E3%81%AF%202048%20N%20%E3%83%90%E3%82%A4%E3%83%88%E3%81%A7%E5%88%9D%E6%9C%9F%E5%8C%96%E3%81%95%E3%82%8C%E3%80%81%E3%82%A8%E3%83%B3%E3%83%89%E3%83%9D%E3%82%A4%E3%83%B3%E3%83%88%E3%81%AF%E3%82%A2%E3%82%AF%E3%83%86%E3%82%A3%E3%83%96%E3%81%AB%E8%A8%AD%E5%AE%9A%E3%81%95%E3%82%8C%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E%E6%9C%9F%E5%BE%85%3A%20%E3%81%9D%E3%82%8C%E4%BB%A5%E4%B8%8A%E3%81%AE%E3%82%84%E3%82%8A%E5%8F%96%E3%82%8A%E3%81%8C%E3%81%AA%E3%81%91%E3%82%8C%E3%81%B0%E3%80%81NYET%20%E5%BF%9C%E7%AD%94%E3%81%AA%E3%81%97%E3%81%A7%204096%20%E3%83%90%E3%82%A4%E3%83%88%E3%81%8C%E5%8F%97%E4%BF%A1%E3%81%95%E3%82%8C%E3%82%8B%E3%81%AF%E3%81%9A%E3%81%A7%E3%81%99%E3%80%82%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%E8%A6%B3%E5%AF%9F%E3%81%95%E3%82%8C%E3%81%9F%E5%8B%95%E4%BD%9C%3A%20Buf0%20%E3%81%8C%E3%81%84%E3%81%A3%E3%81%B1%E3%81%84%E3%81%AB%E3%81%AA%E3%82%8B%E3%81%A8%E3%80%81Buf1%20%E3%81%8C%E5%AE%8C%E5%85%A8%E3%81%AB%E7%A9%BA%E3%81%A7%E3%82%A2%E3%82%AF%E3%83%86%E3%82%A3%E3%83%96%E3%81%A7%E3%81%82%E3%82%8B%E3%81%AB%E3%82%82%E3%81%8B%E3%81%8B%E3%82%8F%E3%82%89%E3%81%9A%E3%80%81ACK%20%E5%BF%9C%E7%AD%94%E3%81%A7%E3%81%AF%E3%81%AA%E3%81%8F%20NYET%20%E5%BF%9C%E7%AD%94%E3%81%8C%E9%80%81%E4%BF%A1%E3%81%95%E3%82%8C%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Bild%202025-10-07%20at%2001.17.49.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Bild%202025-10-07%20at%2001.17.49.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F359753i9A2043D029B44F6A%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Bild%202025-10-07%20at%2001.17.49.png%22%20alt%3D%22Bild%202025-10-07%20at%2001.17.49.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%E3%81%93%E3%81%AE%E5%8B%95%E4%BD%9C%E3%81%AF%E3%80%81Buf0%20%E3%81%A8%20Buf1%20%E3%81%AB%20512%20%E3%83%90%E3%82%A4%E3%83%88%E3%81%AE%E3%83%90%E3%83%83%E3%83%95%E3%82%A1%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8BCASE%E3%80%81%E3%83%91%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%B3%E3%82%B9%E3%81%AB%E7%89%B9%E3%81%AB%E6%82%AA%E5%BD%B1%E9%9F%BF%E3%82%92%E5%8F%8A%E3%81%BC%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%E3%81%93%E3%81%AECASE%E3%80%81%E3%83%9B%E3%82%B9%E3%83%88%E3%81%8B%E3%82%89%E3%81%AE%20OUT%20%E9%80%81%E4%BF%A1%E3%81%94%E3%81%A8%E3%81%AB%20NYET%20%E5%BF%9C%E7%AD%94%E3%81%8C%E9%80%81%E4%BF%A1%E3%81%95%E3%82%8C%E3%80%81%E4%B8%8D%E8%A6%81%E3%81%AA%20USB-Ping%20%E3%81%8C%E5%BF%85%E8%A6%81%E3%81%A8%E3%81%AA%E3%82%8A%E3%80%81%E3%82%B9%E3%83%AB%E3%83%BC%E3%83%97%E3%83%83%E3%83%88%E3%81%8C%E4%BD%8E%E4%B8%8B%E3%81%99%E3%82%8B%E3%81%9F%E3%82%81%E3%81%A7%E3%81%99%E3%80%82%3C%2FP%3E%3CP%3E%E5%9B%9E%E9%81%BF%E7%AD%96%E3%81%AF%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%81%8B%E3%80%81%E3%81%9D%E3%82%8C%E3%81%A8%E3%82%82%E3%83%8F%E3%83%BC%E3%83%89%E3%82%A6%E3%82%A7%E3%82%A2%E3%81%AE%E3%83%90%E3%82%B0%E3%81%A7%E3%81%97%E3%82%87%E3%81%86%E3%81%8B%3F%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2187498%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20USB%20NYET%20response%20despite%20of%20free%20buffer%20(LPC55S69%20USB1%20HS%20Controller)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2187498%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F186731%22%20target%3D%22_blank%22%3E%40EdwinHz%3C%2FA%3E%20%E3%80%81%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%E3%81%93%E3%81%AE%E3%83%88%E3%83%94%E3%83%83%E3%82%AF%E3%81%AF%20LPM%20%E3%83%88%E3%83%BC%E3%82%AF%E3%83%B3%E3%81%AB%E9%96%A2%E3%81%99%E3%82%8B%E3%82%82%E3%81%AE%E3%81%A7%E3%81%AF%E3%81%82%E3%82%8A%E3%81%BE%E3%81%9B%E3%82%93%E3%80%82USB%20%E3%83%9B%E3%82%B9%E3%83%88%E3%81%8B%E3%82%89%20LPC55S69%20%E3%81%AE%20EP2%20%E3%81%AB%E3%83%A6%E3%83%BC%E3%82%B6%E3%83%BC%20%E3%83%87%E3%83%BC%E3%82%BF%E3%82%92%E9%80%81%E4%BF%A1%E3%81%99%E3%82%8B%E3%81%93%E3%81%A8%E3%81%A7%E3%81%99%E3%80%82%E3%83%AA%E3%83%B3%E3%82%AF%E9%9B%BB%E6%BA%90%E7%AE%A1%E7%90%86%E3%81%A8%E9%96%A2%E9%80%A3%E3%81%99%E3%82%8B%E3%83%88%E3%83%A9%E3%83%B3%E3%82%B6%E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AF%E5%AE%8C%E5%85%A8%E3%81%AB%E5%88%A5%E3%81%AE%E3%83%88%E3%83%94%E3%83%83%E3%82%AF%E3%81%A7%E3%81%99%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2186049%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20USB%20NYET%20response%20despite%20of%20free%20buffer%20(LPC55S69%20USB1%20HS%20Controller)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2186049%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F244769%22%20target%3D%22_blank%22%3E%40pettel%3C%2FA%3E%20%E3%80%81%3C%2FP%3E%0A%3CP%3E%E3%81%93%E3%82%8C%E3%81%AF%E3%80%81SDK%20%E3%81%AE%20USB%20%E3%82%B9%E3%82%BF%E3%83%83%E3%82%AF%E5%AE%9F%E8%A3%85%E3%81%AE%E3%83%87%E3%82%B6%E3%82%A4%E3%83%B3%E3%81%AB%E3%82%88%E3%82%8B%E3%82%82%E3%81%AE%E3%81%A7%E3%81%99%E3%80%82%E3%80%8CPERI_USBHSD.h%E3%80%8D%E3%81%AE%E3%82%B3%E3%83%A1%E3%83%B3%E3%83%88%E3%82%92%E8%A6%8B%E3%82%8B%E3%81%A8%E6%AC%A1%E3%81%AECAN%E3%81%8C%E3%82%8F%E3%81%8B%E3%82%8A%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%0A%3CPRE%20translate%3D%22no%22%3EDATA_PENDING%20-%20As%20long%20as%20this%20bit%20is%20set%20to%20one%20and%20LPM%20supported%20bit%20is%20set%20to%20one%2C%20HW%20will%3CBR%20%2F%3E*%20return%20a%20NYET%20handshake%20on%20every%20LPM%20token%20it%20receives.%20If%20LPM%20supported%20bit%20is%20set%20to%20one%20and%3CBR%20%2F%3E*%20this%20bit%20is%20zero%2C%20HW%20will%20return%20an%20ACK%20handshake%20on%20every%20LPM%20token%20it%20receives.%20If%20SW%20has%3CBR%20%2F%3E*%20still%20data%20pending%20and%20LPM%20is%20supported%2C%20it%20must%20set%20this%20bit%20to%201.%3C%2FPRE%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E