Found during camera-fpga full-frame-readout bring-up (OpenwaterHealth/openmotion-camera-fpga#5), present in 1.8.1-rc.3 and current branches incl. feature/68.
Path: OW_FPGA_BITSTREAM blocks fill bitstream_buffer (host bitstream, CRC-checked) → OW_FPGA_PROG_SRAM reserved=0 → program_sram_fpga(cam, rom_bitstream=true, ...) → fpga_program_sram (crosslink.c:396) → xi2c_write_long(hi2c, addr, cmd, 4, (uint8_t*)bitstream_buffer, bitstream_len) (crosslink.c:408).
Bug: xi2c_write_long (crosslink.c:88) begins with
memset(bitstream_buffer, 0, MAX_BITSTREAM_SIZE) then
memcpy(bitstream_buffer + cmd_len, data, data_len) — when data IS bitstream_buffer (the reserved=0 path), the memset zeroes the source before the copy, so the CrossLink receives the 0x7A command followed by zeros. The embedded-flash path (fpga_configure → ADDR_CAMERA_BITSTREAM) is unaffected because its source is flash, not the shared scratch buffer.
Also observed while working around it (informational): after any DFU session, the app's USB does not re-enumerate until a full power cycle — worth confirming whether that's expected on these boards.
Suggested fix: give xi2c_write_long its own scratch/chunk buffer (it only needs cmd_len+chunk bytes at a time — stream directly from the source with a small prefix buffer for the first chunk), or forbid data==bitstream_buffer and add a separate upload buffer.
Workaround used: DFU-rewrite the dedicated bitstream flash sectors (0x081A0000, 163489 B) and program via the stock path.
Found during camera-fpga full-frame-readout bring-up (OpenwaterHealth/openmotion-camera-fpga#5), present in 1.8.1-rc.3 and current branches incl. feature/68.
Path: OW_FPGA_BITSTREAM blocks fill
bitstream_buffer(host bitstream, CRC-checked) → OW_FPGA_PROG_SRAM reserved=0 →program_sram_fpga(cam, rom_bitstream=true, ...)→fpga_program_sram(crosslink.c:396) →xi2c_write_long(hi2c, addr, cmd, 4, (uint8_t*)bitstream_buffer, bitstream_len)(crosslink.c:408).Bug:
xi2c_write_long(crosslink.c:88) begins withmemset(bitstream_buffer, 0, MAX_BITSTREAM_SIZE)thenmemcpy(bitstream_buffer + cmd_len, data, data_len)— whendataISbitstream_buffer(the reserved=0 path), the memset zeroes the source before the copy, so the CrossLink receives the 0x7A command followed by zeros. The embedded-flash path (fpga_configure → ADDR_CAMERA_BITSTREAM) is unaffected because its source is flash, not the shared scratch buffer.Also observed while working around it (informational): after any DFU session, the app's USB does not re-enumerate until a full power cycle — worth confirming whether that's expected on these boards.
Suggested fix: give xi2c_write_long its own scratch/chunk buffer (it only needs cmd_len+chunk bytes at a time — stream directly from the source with a small prefix buffer for the first chunk), or forbid data==bitstream_buffer and add a separate upload buffer.
Workaround used: DFU-rewrite the dedicated bitstream flash sectors (0x081A0000, 163489 B) and program via the stock path.