mattdibi / redox-keyboard

Ergonomic split mechanical keyboard
MIT License
1.78k stars 167 forks source link

Can't flash entire 43kb hex image to redox-w keyboard. Only 16kb writes. #44

Closed forkedcancel closed 4 years ago

forkedcancel commented 4 years ago

I was having range issues (unreliable transmission within just a few feet) with my redox-w so I set out to change the tx power to 4dB. I updated the main.c to add that change and subsequently bricked my keyboard (mine came from Falbatech as partially assembled so I never had to flash anything other than qmk). Here is the output from program_left.sh. I am running Arch Linux for what it's worth.

=============================== MAKING ================================
rm -rf _build
echo  Makefile
Makefile
mkdir _build
Compiling file: system_nrf51.c
Compiling file: main.c
Compiling file: nrf_delay.c
Compiling file: nrf_drv_clock.c
Compiling file: app_util_platform.c
Compiling file: nrf_drv_common.c
Compiling file: nrf_drv_rtc.c
Assembly file: gcc_startup_nrf51.s
Linking target: nrf51822_xxac-keyboard-left.out
make[1]: Entering directory '/home/wrose/git/nRF5_SDK_11/redox-w-firmware/redox-w-keyboard-basic/custom/armgcc'
Preparing: nrf51822_xxac-keyboard-left.bin
Preparing: nrf51822_xxac-keyboard-left.hex

   text    data     bss     dec     hex filename
  15424     140    1280   16844    41cc _build/nrf51822_xxac-keyboard-left.out

make[1]: Leaving directory '/home/wrose/git/nRF5_SDK_11/redox-w-firmware/redox-w-keyboard-basic/custom/armgcc'
43824   /home/wrose/git/nRF5_SDK_11/redox-w-firmware/redox-w-keyboard-basic/custom/armgcc/_build/nrf51822_xxac-keyboard-left.hex

============================= PROGRAMMING =============================
Trying ::1...
Connection failed: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> reset halt
target halted due to debug-request, current mode: Thread 
xPSR: 0xc1000000 pc: 0x00000d78 msp: 0x20004000
> flash write_image erase /home/wrose/git/nRF5_SDK_11/redox-w-firmware/redox-w-keyboard-basic/custom/armgcc/_build/nrf51822_xxac-keyboard-left.hex
auto erase enabled
Unknown device (HWID 0x00000138)
using fast async flash loader. This is currently supported
only with ST-Link and CMSIS-DAP. If you have issues, add
"set WORKAREASIZE 0" before sourcing nrf51.cfg to disable it
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000001e msp: 0x20004000
wrote 16384 bytes from file /home/wrose/git/nRF5_SDK_11/redox-w-firmware/redox-w-keyboard-basic/custom/armgcc/_build/nrf51822_xxac-keyboard-left.hex in 0.764241s (20.936 KiB/s)
> reset
> Connection closed by foreign host.

I have tried setting WORKAREASIZE to 0, and to 0x10000 (64k), but no matter what it always says "wrote 16384 bytes." Is that correct? My hex file is like 43kb - shouldn't it be writing that many bytes (43832 to be exact) to the nRF51?

It seems like the answer to this is yes. Unfortunately I can't seem to find anyone talking about this problem when I search.

Any ideas?

forkedcancel commented 4 years ago

Apparently I'm mistaken. It would seem the numbers are correct.

So that just means I've bricked my keyboard in some other way? I've tried flashing the precompiled hex files that come with the latest version of the repo but still the keyboard apparently sends nothing to the receiver.

Is there a chance I need to flash the receiver also? I'm a little worried about doing that now because I've already got 2 broken things, do I really want 3 broken things? But maybe that's the solution, to flash all 3 with the latest.

forkedcancel commented 4 years ago

Aaaaand it turns out that was my problem. Seems all 3 needed to be updating. Closing.