-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Enhance HITL test #2209
Enhance HITL test #2209
Conversation
@HiFiPhile yeah, I notice MSC is not showed up on your VM. I thought it is due your VM not enable auto mount block device, I remembered we could find it /dev/sda. I guess we have to manual mount ? I will check out the PR later. |
It's true. I set udev alias, it will show up with something like |
we should actually read the contents of README.TXT to verify that it works. Give me a bit of time. I will add manual mount to this PR when possible. |
Currently I read the content directly from block device. tinyusb/test/hitl/hitl_test.py Lines 109 to 115 in 87150b7
I was too lazy to do mounting rightly to take care permissions and when multiples devices running |
Now it read README.TXT from mounted device. |
thank you perfect, I will check this out soon enough. Though one thing pop up in my mind. I think at the end of the CI. We should flash board_test example. This will disable the usb on the tested board. Making testing the next board easier, at least it will more forgiving in our test script. |
lpc54 has an issue with receiving 31 bytes for msc command and sending 13 for msc status. Somehow when the transfer is complete, it is only 30 bytes (1 residue) and 12 bytes. Seem like the interrupt triggered a bit early or something. I have spent something troubleshoot, but not quite sure what is wrong. We probably need to skip the lpc54 for now, lpc55 has no issue with this though, strange. |
Yes we can fix it later. |
@HiFiPhile everything looks great and the python test script is way better than my shell script and easier to work with. Though I think we may have to modify it a bit to work better with ci. I will try to wrap this up tomorrow. |
I was looking around for lpc54 issue and found there are 17 USB issues in errata sheet, that's a lot... Maybe it's related:
|
yeah, thank for the info, I should have checked errata. As tested, I also saw it in the bulk in as well (12 instead 13 bytes for msc status) which is more severe as there is no walkaround. A quick look around, and there is tons of errata, tx data corruption 3.22 is also severe I could add walkarond for bulk in/out so that it is kind of usable with stock examples. but I don't know if we have time to go through all of errata, look like usb on lpc54 is a headache one. I would definitely avoid lpc54 for a production with usb. |
…B.1 and USB.2 msc is mounted, but device couldn't work reliably and got constant reset due to other errata probably.
test/hitl/hitl_test.py
Outdated
|
||
def test_cdc_msc(id): | ||
port = f'/dev/ttyUSB_{id[-8:]}.00' | ||
file = f'/media/blkUSB_{id[-8:]}.02/README.TXT' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HiFiPhile why would you limit the serial number to 8 characters, wouldn't be simpler to use it as it is ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some historical reason my udev script cut serial number to 8 characters.
In fact udev rule is not even needed, cdc can be accessed by /dev/serial/by-id/usb-TinyUSB_TinyUSB_Device_41003B000E504E5457323020-if00
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I figure that out as well. I have already made the changes, just want double check if you first. The id is also shorten in blk device, if it only impact serial, then we are probably safe to remove the cut ?
def get_serial_dev(id, product, ifnum):
# get usb serial by id
return f'/dev/serial/by-id/usb-TinyUSB_{product}_{id}-if{ifnum:02d}'
def get_disk_dev(id, lun):
# get usb disk by id
return f'/dev/disk/by-id/usb-TinyUSB_Mass_Storage_{id}-0:{lun}'
def get_hid_dev(id, product, event):
return f'/dev/input/by-id/usb-TinyUSB_{product}_{id}-{event}'
PS: I am trying to get the script also running with my pi4 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The id is also shorten in blk device, if it only impact serial, then we are probably safe to remove the cut ?
Yes you are right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since I am in the middle of this, let me try to do this as well. At worst, we could revert if I messed up :)
…on ci with IAR build
I pushed my changes which include:
PS: I still need to do more work to update my pi4 with this excellent script. Though pi4 auto mount msc device, but that could be done later once this running well on your VM. |
name: stm32l4 | ||
path: | | ||
*.elf | ||
python3 test/hil/hil_test.py hil_hfp.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is where the script is run, CI compile with IAR using cmake build in previous step. We could pick up the elf. This will conveniently test IAR for us as well. (normally I only test with gcc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything seems to work well now, except for the lpc54 which has horrible usb hs implementation. The MSC still use the 8 byte ID ( didn't manage time to update that). But it is all good for the merge. We can update thing later with follow-up PRs. @HiFiPhile let me know if you are ok with my changes, and/or want to make more changes.
before I forgot here is the lpc54 setting, should we want to re-add it later (couldn't find way to comment out in json) {
"name": "lpcxpresso54608",
"uid": "0123456789ABCDEF",
"debugger": "jlink",
"debugger_sn": "727600775",
"cpu": "LPC54608J512",
"tests_skip": [
"cdc_msc"
]
} |
Perfect it's good for me, maybe also let it run for GCC build. |
yeah, that is possible as well, though I think we are good enough for now. Since we do generally test with gcc when developement. IAR is much rarer, so I am glad it is covered by HIL. Thank you very much for work and VM/board farm for doing actual test. |
Describe the PR
Add HITL testing script for newly added boards #2194
Currently support
cdc_dual_ports
,cdc_msc
,dfu
,dfu_runtime
, more tests will be added later on.For my instance use
python test/hitl/hitl_test.py hitl_hfp.json
I'm not familiar with Github, @hathach could you take a look for CI integration ?
Additional context
Actually it catched something !
My lpcxpresso54608 (even modified 54628 to 54608 in board.mk) failed with cdc_msc test, msc block doesn't show up :
Log:
msc.zip