Closed jamesadevine closed 3 years ago
same with keyboard
(gdb) i stack
#0 0x08027052 in USB_ReadDevInEPInterrupt (USBx=<optimized out>, epnum=epnum@entry=2 '\002') at /Users/James/Desktop/VM/MSR/pxt-maker-dev/pxt-maker/projects/jacdac-f4-brain/built/codal/libraries/codal-stm32/stm32cube/stm32f4xx/drivers/src/stm32f4xx_ll_usb.c:1112
#1 0x08020364 in writeEP (len=64, ep=2 '\002', data=0x20016958 "") at /Users/James/Desktop/VM/MSR/pxt-maker-dev/pxt-maker/projects/jacdac-f4-brain/built/codal/libraries/codal-stm32/src/USB.cpp:357
#2 UsbEndpointIn::write (this=0x20016958, src=src@entry=0x20017e58, len=len@entry=64) at /Users/James/Desktop/VM/MSR/pxt-maker-dev/pxt-maker/projects/jacdac-f4-brain/built/codal/libraries/codal-stm32/src/USB.cpp:398
#3 0x0801f0ae in codal::USBHID::endpointRequest (this=<optimized out>) at /Users/James/Desktop/VM/MSR/pxt-maker-dev/pxt-maker/projects/jacdac-f4-brain/built/codal/libraries/codal-core/source/drivers/HID.cpp:111
Seems that the end point is not transmitting to host...
This is caused by userdata in the USBOutEndpoint getting corrupted with a non-zero value. This causes the usb keyboard driver to think it has data and attempt to read. There is no data to read, and the data written by the device never gets read by the host.
There are a couple of easy fixes, but neither are the correct fix. More debugging required.
I think this is just a memory layout problem.
We may need to add another codal target and specific target for the F4 brain:
{
"architecture": "CORTEX_M4",
"asm_flags": "-fno-exceptions -fno-unwind-tables",
"c_flags": "-std=c99 -fwrapv -Warray-bounds",
"cmake_definitions": {},
"config": {
"CODAL_DEBUG": "CODAL_DEBUG_DISABLED",
"CODAL_TIMESTAMP": "uint64_t",
"DEVICE_COMPONENT_COUNT": 60,
"DEVICE_DEFAULT_PULLMODE": "PullMode::None",
"DEVICE_DEFAULT_SERIAL_MODE": "SYNC_SLEEP",
"DEVICE_DMESG_BUFFER_SIZE": 2048,
"DEVICE_HEAP_ALLOCATOR": 1,
"DEVICE_PANIC_HEAP_FULL": 1,
"DEVICE_SRAM_BASE": "0x200000EC",
"DEVICE_SRAM_END": "0x20020000",
"DEVICE_STACK_BASE": "DEVICE_SRAM_END",
"DEVICE_STACK_SIZE": 2048,
"DEVICE_TAG": 0,
"DEVICE_USB": 0,
"EVENT_LISTENER_DEFAULT_FLAGS": "MESSAGE_BUS_LISTENER_QUEUE_IF_BUSY",
"MESSAGE_BUS_LISTENER_MAX_QUEUE_DEPTH": 10,
"PROCESSOR_WORD_TYPE": "uint32_t",
"SCHEDULER_TICK_PERIOD_US": 4000,
"USE_ACCEL_LSB": 0
},
"cpp_flags": "-std=c++11 -fwrapv -fno-rtti -fno-threadsafe-statics -fno-exceptions -fno-unwind-tables -Wl,--gc-sections -Wl,--sort-common -Wl,--sort-section=alignment -Wno-array-bounds",
"cpu_opts": "-mcpu=cortex-m4 -mthumb -mfloat-abi=softfp -mfpu=fpv4-sp-d16",
"definitions": "-DSTM32F4 -DSTM32F411xE -include codal-big-brainpad/inc/localconf.h",
"device": "STM32",
"generate_bin": true,
"generate_hex": true,
"libraries": [
{
"branch": "e2efc4cb034b04e5db5d7f6669667194b4a49024",
"name": "codal-core",
"type": "git",
"url": "https://github.com/lancaster-university/codal-core"
},
{
"branch": "afeb2f2b5d4fece3a0112b54c28d81f97a7335c5",
"name": "codal-stm32",
"type": "git",
"url": "https://github.com/lancaster-university/codal-stm32"
}
],
"linker_flags": "-Wl,--no-wchar-size-warning -Wl,--gc-sections -mcpu=cortex-m4 -mthumb",
"post_process": "python ./utils/uf2conv.py -b 0x08010000 -o <OUTPUT_HEX_DESTINATION>/<OUTPUT_HEX_NAME>.uf2 -c <OUTPUT_BIN_LOCATION>",
"processor": "STM32F4",
"snapshot_version": "v1.3.2",
"toolchain": "ARM_GCC"
}
The above target.json appears to work locally. I'll work on a PR!
Scratch that, it's something else...
Keyboard works on Mac (Windows not working) with the following patch to HID.cpp:
int USBHID::endpointRequest()
{
if (!out)
return 0;
uint8_t buf[64];
....
``
Ha windows...
I can start to test on Mac though
@mmoskal welcome back... this is your priority -1 for tomorrow :smile:
fix should go live in maker v0.15.23
Describe the bug
When mouse package is used in MakeCode, F4 brain crashes.
Needs to be investigated.