You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Code will run then mysteriously stop, debugging and turning on the pico_info instrumentation points to the _hw_endpoint_alloc function line 84:
pico_info("Alloced %d bytes at offset 0x%x (0x%p) for ep %d %s\n",
size,
dpram_offset,
ep->hw_data_buf,
ep->num,
ep_dir_string[ep->in]);
// Fill in endpoint control register with buffer offset
uint32_treg=EP_CTRL_ENABLE_BITS
| EP_CTRL_INTERRUPT_PER_BUFFER
| (ep->transfer_type << EP_CTRL_BUFFER_TYPE_LSB)
| dpram_offset;
*ep->endpoint_control=reg;
}
In that function it isn't clear to me where the memory reuse happens it looks like it just keeps pushing the buffer to the next set of memory.
if if add the following code the the device seems to run properly, though I have to admit I don't understand the system well enough to know if it is allowed. All it is doing is pointing next_buffer_ptr to where it is initially initialized.
I that I am fairly certain that the assert(hw_data_offset(next_buffer_ptr) <= USB_DPRAM_MAX); is wrong and should be assert(hw_data_offset(next_buffer_ptr) <= (USB_DPRAM_MAX+size)); to account for the size of the buffer and prevent a buffer overflow.
To reproduce
Steps to reproduce the behavior:
Go to '...'
Click on '....'
See error
Screenshots
If applicable, add screenshots, bus capture to help explain your problem.
Log
This is not the whole long just the portion before is fails.
hw_endpoint_xfer ep 1 in total_len 98, start=1
Start transfer of total len 98 on ep 1 in
buffer buf_status 0x00000004
tx 64 bytes (buf_ctrl 0x00000040)
Last buf (34 bytes left)
buffer control (0x50100088) <- 0xe422
buf_status 0x00000004
tx 34 bytes (buf_ctrl 0x00006022)
Completed transfer of 98 bytes on ep 1 in
control (0x50100088) <- 0x8440
hw_endpoint_xfer ep 1 out total_len 192, start=1
Start transfer of total len 192 on ep 1 out
buffbuf_status 0x00000008
rx 64 bytes (buf_ctrl 0x0000a040)
buffer control (0x5010008C) <- 0x440
buf_status 0x00000008
rx 64 bytes (buf_ctrl 0x00008040)
Last buf (64 bytes left)
buffer control (0x5010008C) <- 0x6440
buf_status 0x00000008
rx 64 bytes (buf_ctrl 0x0000e040)
Completed transfer of 192 bytes on ep 1 out
er control (0x5010008C) <- 0x2440
hw_endpoint_xfer ep 1 in total_len 98, start=1
Start transfer of total len 98 on ep 1 in
buf_status 0x00000004
tx 64 bytes (buf_ctrl 0x00000040)
Last buf (34 bytes left)
buffer control (0x50100088) <- 0xe422
buf_status 0x00000004
tx 34 bytes (buf_ctrl 0x00006022)
Completed transfer of 98 bytes on ep 1 in
buffer control (0x50100088) <- 0x8440
hw_endpoint_xfer ep 1 out total_len 192, start=1
Start transfer of total len 192 on ep 1 out
buffer control (0x5010008C) <- 0x440
dcd_edpt_close 0 01
hw_endpoint_xfer ep 0 in total_len 0, start=1
Start transfer of total len 0 on ep 0 in
Last buf (0 bytes left)
buf_status 0x00000001
tx 0 bytes (buf_ctrl 0x00006000)
Completed transfer of 0 bytes on ep 0 in
buffer control (0x50100080) <- 0xe400
hw_endpoint_xfer ep 1 in total_len 98, start=1
Start transfer of total len 98 on ep 1 in
buffer control (0x50100088) <- 0x8440
dcd_edpt0_status_complete 0
dcd_edpt_close 0 81
hw_endpoint_xfer ep 0 in total_len 0, start=1
Start transfer of total len 0 on ep 0 in
Last buf (0 bytes left)
buf_status 0x00000001
tx 0 bytes (buf_ctrl 0x00006000)
Completed transfer of 0 bytes on ep 0 in
buffer control (0x50100080) <- 0xe400
dcd_edpt0_status_complete 0
assertion "hw_data_offset(next_buffer_ptr) <= USB_DPRAM_MAX" failed: file "...../tinyusb/src/portable/raspberrypi/rp2040/dcd_rp2040.c", line 84, function: _hw_endpoint_alloc
The text was updated successfully, but these errors were encountered:
Set up
[Mandatory] Provide details of your setup help us to reproduce the issue as quick as possible
Describe the bug
Code will run then mysteriously stop, debugging and turning on the pico_info instrumentation points to the _hw_endpoint_alloc function line 84:
tinyusb/src/portable/raspberrypi/rp2040/dcd_rp2040.c
Lines 65 to 100 in 148a5a9
In that function it isn't clear to me where the memory reuse happens it looks like it just keeps pushing the buffer to the next set of memory.
if if add the following code the the device seems to run properly, though I have to admit I don't understand the system well enough to know if it is allowed. All it is doing is pointing next_buffer_ptr to where it is initially initialized.
I that I am fairly certain that the
assert(hw_data_offset(next_buffer_ptr) <= USB_DPRAM_MAX);
is wrong and should beassert(hw_data_offset(next_buffer_ptr) <= (USB_DPRAM_MAX+size));
to account for the size of the buffer and prevent a buffer overflow.To reproduce
Steps to reproduce the behavior:
Screenshots
If applicable, add screenshots, bus capture to help explain your problem.
Log
This is not the whole long just the portion before is fails.
The text was updated successfully, but these errors were encountered: