Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAPv1 bundled with DAPv2 has compatibility issues #915

Closed
elfmimi opened this issue Dec 28, 2021 · 7 comments · Fixed by #917 or #922
Closed

DAPv1 bundled with DAPv2 has compatibility issues #915

elfmimi opened this issue Dec 28, 2021 · 7 comments · Fixed by #917 or #922

Comments

@elfmimi
Copy link
Contributor

elfmimi commented Dec 28, 2021

HID interface of DAPLink may not functioning as expected when bulk interface is also present.
It seems there are more than one pattern of behaviors.
I've analyzed these two out of many.

  • firmware-0257-798b9e73/gcc/0257_lpc11u35__0x0000.hex
    HID interface does not have any endpoint, because of endpoint shortage.
    Host must use SET_REPORT and GET_REPORT to interact with this.
    Not many software is aware of this kind of configuration.
    Even Linux won't bind hid driver for this device.

  • firmware-0257-798b9e73/gcc/0257_lpc55s69__0x10000.hex
    HID interface has both IN and OUT endpoints.
    Despite having OUT endpoint it will get stuck if try to use it.
    Host must use SET_REPORT to workaround the problem.

    Solved with Fix HID interface of LPC55xx HIC #917

@mbrossard
Copy link
Contributor

LPC55S69 HIC fix has been merged. lpc11u35_if is the only project using the lpc11u35 HIC that has bulk interface. There might be 3 simple solutions:

  • Remove bulk interface from lpc11u35_if.
  • Remove HID interface from lpc11u35_if.
  • Remove bulk interface from lpc11u35_if and add lpc11u35_bulk_if with bulk (instead of HID) interface.

@mbrossard
Copy link
Contributor

I tried creating a project with bulk interface but without HID interface and it did not work, so as a first step #920 changes lpc11u35_if to be HID-only, like all other lpc11u35-based projects.

@elfmimi
Copy link
Contributor Author

elfmimi commented Jan 4, 2022

I don't yet know why, but this must be the cause bulk interface without HID interface is failing.

#ifndef HID_ENDPOINT //HID end points currently set limits to 64
#define DAP_PACKET_SIZE 512 ///< Specifies Packet Size in bytes.
#else
#define DAP_PACKET_SIZE 64 ///< Specifies Packet Size in bytes.
#endif

Try changing it to 64 , then it should work fine.

mbrossard added a commit to mbrossard/DAPLink that referenced this issue Jan 4, 2022
@mbrossard
Copy link
Contributor

mbrossard commented Jan 4, 2022

Looking at the USB configuration it seems all interefaces are limited to 64 bytes:

$ grep WMAXPACKETSIZE source/hic_hal/nxp/lpc11u35/usb_config.c | grep -v _HS_
#define USBD_HID_WMAXPACKETSIZE     64
#define USBD_MSC_WMAXPACKETSIZE     64
#define USBD_ADC_WMAXPACKETSIZE     64
#define USBD_CDC_ACM_WMAXPACKETSIZE     16
#define USBD_CDC_ACM_WMAXPACKETSIZE1    64
#define USBD_BULK_WMAXPACKETSIZE     64
[...]

I took your advice in https://github.com/mbrossard/DAPLink/tree/pr/lpc11u35_if_bulk and it seems to work.

mbrossard added a commit to mbrossard/DAPLink that referenced this issue Jan 5, 2022
@mbrossard mbrossard linked a pull request Jan 5, 2022 that will close this issue
@eleenest
Copy link

eleenest commented Jan 8, 2022

Just wondering if this issue is only for the lpc11u35_if (maybe a smaller number of hw endpoints available on this MCU?), or if other HICs with a bulk interface are also affected

(looks like a total of 12 interfaces with - records/usb/usb-bulk.yaml in projects.yaml)?

Eric

@mbrossard
Copy link
Contributor

Just wondering if this issue is only for the lpc11u35_if (maybe a smaller number of hw endpoints available on this MCU?), or if other HICs with a bulk interface are also affected

(looks like a total of 12 interfaces with - records/usb/usb-bulk.yaml in projects.yaml)?

I think so. The LPC11U35 "[s]upports 10 physical (5 logical) endpoints including one control endpoint" (https://www.nxp.com/docs/en/data-sheet/LPC11U3X.pdf). We should probably document the number of end-points each HIC has.

@mbrossard
Copy link
Contributor

mbrossard commented Jan 8, 2022

I checked and documented [df8e414], it seems the only other that might be problematic are the MAX3262x.

gaborcsapo pushed a commit to gaborcsapo/DAPLink that referenced this issue Jun 29, 2022
gaborcsapo pushed a commit to gaborcsapo/DAPLink that referenced this issue Jun 29, 2022
gaborcsapo pushed a commit to gaborcsapo/DAPLink that referenced this issue Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants