Trouble with lpc flashing

I followed the instructions here Parts — MNT Reform Operator Handbook documentation but no usb device message in dmesg after step 3.

Any suggestions for troubleshooting?

One question I had when reading: should the reform have ac power or battery power or both or neither?

I got it working, might have been a bad cable. Still not sure about the power question.

Did you flash without batteries connected? I think the documentation could at least point out disconnecting the power beforehand if that’s necessary.

I’m running into the same issue, and was wondering if anyone else has troubleshooting ideas.
I’m trying to update the firmware for my Reform to get some of the newer features (like the ability to see the battery status on the Waybar). I’m following the iFixit guide, but I’m stuck on step 6. The LPC does not appear on my other computer (a 2016 ASUS laptop running Linux Mint).
I thought the problem might have been related to the USB Micro-B to USB-A Cable - I know that some cables are power only. However, I’ve now tried three different cables, with no luck. I’ve also tried 2 different USB ports on my ASUS laptop (and was able to connect a USB thumb drive to them to verify that the work).
I also wasn’t sure if I was supposed to leave the batteries connected. I removed them the first time (as I believe it is best practice to have them out when working on the system). But the pictures on the iFixit guide show the batteries in place, so I tried it again with the batteries in the system. It didn’t seem to make a difference.

I’ve also verified the USB cable by using it to connect to a different data device and verifying that data transfer works (since I know that cables that don’t transmit data is a common problem Identifying data transfer micro USB cables vs charge only micro USB cables - Super User)

I was able to connect by first pressing Circle-B to wake up the lpc.
However, now I’m having trouble compiling the firmware. Here is the output from make:

keith@keith-Q534UX:~/Downloads/reform2-lpc-fw$ make
COMPILING startup_lpc11u_gnumake.o
COMPILING system_LPC11Uxx.o
COMPILING math_helper.o
COMPILING RTX_hook.o
COMPILING printf-retarget.o
COMPILING board_lpcnfc.o
COMPILING board_reform2.o
src/boards/reform2/board_reform2.c: In function 'disable_charge_current':
src/boards/reform2/board_reform2.c:262:7: error: 'REFORM_MOTHERBOARD_REV' undeclared (first use in this function)
  262 |   if (REFORM_MOTHERBOARD_REV >= REFORM_MBREV_R1) {
      |       ^~~~~~~~~~~~~~~~~~~~~~
src/boards/reform2/board_reform2.c:262:7: note: each undeclared identifier is reported only once for each function it appears in
src/boards/reform2/board_reform2.c: In function 'enable_charge_current':
src/boards/reform2/board_reform2.c:270:7: error: 'REFORM_MOTHERBOARD_REV' undeclared (first use in this function)
  270 |   if (REFORM_MOTHERBOARD_REV >= REFORM_MBREV_R1) {
      |       ^~~~~~~~~~~~~~~~~~~~~~
src/boards/reform2/board_reform2.c: In function 'turn_som_power_on':
src/boards/reform2/board_reform2.c:470:7: error: 'REFORM_MOTHERBOARD_REV' undeclared (first use in this function)
  470 |   if (REFORM_MOTHERBOARD_REV >= REFORM_MBREV_R1 && REFORM_MOTHERBOARD_REV < REFORM_MBREV_25_R2) {
      |       ^~~~~~~~~~~~~~~~~~~~~~
src/boards/reform2/board_reform2.c: In function 'turn_som_power_off':
src/boards/reform2/board_reform2.c:491:7: error: 'REFORM_MOTHERBOARD_REV' undeclared (first use in this function)
  491 |   if (REFORM_MOTHERBOARD_REV >= REFORM_MBREV_R1 && REFORM_MOTHERBOARD_REV < REFORM_MBREV_25_R2) {
      |       ^~~~~~~~~~~~~~~~~~~~~~
src/boards/reform2/board_reform2.c: In function 'boardInit':
src/boards/reform2/board_reform2.c:611:7: error: 'REFORM_MOTHERBOARD_REV' undeclared (first use in this function)
  611 |   if (REFORM_MOTHERBOARD_REV >= REFORM_MBREV_25_R2) {
      |       ^~~~~~~~~~~~~~~~~~~~~~
src/boards/reform2/board_reform2.c: In function 'handle_commands':
src/boards/reform2/board_reform2.c:66:27: error: expected ')' before 'FW_STRING2'
   66 | #define FW_REV FW_STRING1 FW_STRING2 FW_STRING3
      |                           ^~~~~~~~~~
src/boards/reform2/board_reform2.c:755:30: note: in expansion of macro 'FW_REV'
  755 |           sprintf(uartBuffer,FW_REV"normal,%d,%d,%d\r",cycles_in_state,min_mah,acc_mah);
      |                              ^~~~~~
src/boards/reform2/board_reform2.c:66:27: error: expected ')' before 'FW_STRING2'
   66 | #define FW_REV FW_STRING1 FW_STRING2 FW_STRING3
      |                           ^~~~~~~~~~
src/boards/reform2/board_reform2.c:757:30: note: in expansion of macro 'FW_REV'
  757 |           sprintf(uartBuffer,FW_REV"balancing,%d,%d,%d\r",cycles_in_state,min_mah,acc_mah);
      |                              ^~~~~~
src/boards/reform2/board_reform2.c:66:27: error: expected ')' before 'FW_STRING2'
   66 | #define FW_REV FW_STRING1 FW_STRING2 FW_STRING3
      |                           ^~~~~~~~~~
src/boards/reform2/board_reform2.c:759:30: note: in expansion of macro 'FW_REV'
  759 |           sprintf(uartBuffer,FW_REV"cooldown,%d,%d,%d\r",cycles_in_state,min_mah,acc_mah);
      |                              ^~~~~~
src/boards/reform2/board_reform2.c:66:27: error: expected ')' before 'FW_STRING2'
   66 | #define FW_REV FW_STRING1 FW_STRING2 FW_STRING3
      |                           ^~~~~~~~~~
src/boards/reform2/board_reform2.c:761:30: note: in expansion of macro 'FW_REV'
  761 |           sprintf(uartBuffer,FW_REV"undervolted,%d,%d,%d\r",cycles_in_state,min_mah,acc_mah);
      |                              ^~~~~~
src/boards/reform2/board_reform2.c:66:27: error: expected ')' before 'FW_STRING2'
   66 | #define FW_REV FW_STRING1 FW_STRING2 FW_STRING3
      |                           ^~~~~~~~~~
src/boards/reform2/board_reform2.c:763:30: note: in expansion of macro 'FW_REV'
  763 |           sprintf(uartBuffer,FW_REV"cells missing:%d,%d,%d,%d\r",missing_reason,cycles_in_state,min_mah,acc_mah);
      |                              ^~~~~~
src/boards/reform2/board_reform2.c:66:27: error: expected ')' before 'FW_STRING2'
   66 | #define FW_REV FW_STRING1 FW_STRING2 FW_STRING3
      |                           ^~~~~~~~~~
src/boards/reform2/board_reform2.c:765:30: note: in expansion of macro 'FW_REV'
  765 |           sprintf(uartBuffer,FW_REV"full charge,%d,%d,%d\r",cycles_in_state,min_mah,acc_mah);
      |                              ^~~~~~
src/boards/reform2/board_reform2.c:66:27: error: expected ')' before 'FW_STRING2'
   66 | #define FW_REV FW_STRING1 FW_STRING2 FW_STRING3
      |                           ^~~~~~~~~~
src/boards/reform2/board_reform2.c:767:30: note: in expansion of macro 'FW_REV'
  767 |           sprintf(uartBuffer,FW_REV"powersave,%d,%d,%d\r",cycles_in_state,min_mah,acc_mah);
      |                              ^~~~~~
src/boards/reform2/board_reform2.c:66:27: error: expected ')' before 'FW_STRING2'
   66 | #define FW_REV FW_STRING1 FW_STRING2 FW_STRING3
      |                           ^~~~~~~~~~
src/boards/reform2/board_reform2.c:769:30: note: in expansion of macro 'FW_REV'
  769 |           sprintf(uartBuffer,FW_REV"unknown:%d,%d,%d,%d\r",state,cycles_in_state,min_mah,acc_mah);
      |                              ^~~~~~
src/boards/reform2/board_reform2.c:751:13: warning: unused variable 'min_mah' [-Wunused-variable]
  751 |         int min_mah = (int)(capacity_min_ampsecs/3.6);
      |             ^~~~~~~
src/boards/reform2/board_reform2.c:750:13: warning: unused variable 'acc_mah' [-Wunused-variable]
  750 |         int acc_mah = (int)(capacity_accu_ampsecs/3.6);
      |             ^~~~~~~
src/boards/reform2/board_reform2.c: In function 'handle_spi_commands':
src/boards/reform2/board_reform2.c:986:23: error: 'FW_STRING2' undeclared (first use in this function); did you mean 'FW_STRING1'?
  986 |       memcpy(spi_buf, FW_STRING2, 8);
      |                       ^~~~~~~~~~
      |                       FW_STRING1
src/boards/reform2/board_reform2.c: In function 'main':
src/boards/reform2/board_reform2.c:1169:9: error: 'REFORM_MOTHERBOARD_REV' undeclared (first use in this function)
 1169 |     if (REFORM_MOTHERBOARD_REV >= REFORM_MBREV_25_R2) {
      |         ^~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:404: bin/obj/board_reform2.o] Error 1

The firmware supports multiple motherboards, namely versions 2.0 and 2.5. So when you compile it, you have to tell make what board you want to compile it for, for example for 20_R3:

make REFORM_LPC_OPTIONS="-DREFORM_MOTHERBOARD_REV=REFORM_MBREV_20_R3"

If you didn’t modify the firmware, you can also download pre-built binaries from here:

I also wrote an interactive version of the reform2-lpc-fw/flash.sh script which will guide you through the flashing process step by step by printing things like:

Set the DIP switch LPCPROG to “ON”.
Press the button LPCRESET.
Connect the USB cable.
Waiting for the disk to appear...

I’d be happy for more people testing the script which I submitted as a MR here:

You can download the updated version here:

https://source.mnt.re/reform/reform/-/raw/5fdd6fc277c2a1e6ce633fe909e56c7c5d32c7ac/reform2-lpc-fw/flash.sh

2 Likes

How do you determine which version of the motherboard you have? On the motherboard, by the M2 socket there is a box labelled MNT REFORM MOTHERBOARD with the following information which I assume specifies the version number:
MREFPMOB20R02 CERN-OHL-S 2.0
2020-10-29
MNT RESEARCH GMBH MNTRE.COM
WEEE DE 33315564

Am I correct in assuming that this indicates that this is a version 2.0 board?

I also tried the interactive version of the flash script, but that encountered an error on my machine:

keith@keith-Q534UX:~/Downloads/reform2-lpc-fw$ sudo ./flash.sh
[sudo] password for keith:           
Set the DIP switch LPCPROG to “ON”.
Press the button LPCRESET.
Connect the USB cable.
Waiting for the disk to appear...
Unknown operation wait.
keith@keith-Q534UX:~/Downloads/reform2-lpc-fw$ echo $?
1

I was able to successfully flash the firmware using the original flash.sh script, after building using the make command you linked above.

make REFORM_LPC_OPTIONS="-DREFORM_MOTHERBOARD_REV=REFORM_MBREV_20_R3"

But the first time I ran it I was getting some errors about the lpcrc files. I was able to resolve this by running make in the tools/lpcrc directory.

Yes, this is motherboard 2 and you need firmware-20_R3.bin. I suspect a small table would be helpful which matches SKU numbers to firmware names. Also for keyboard and trackball which now also come in multiple versions. Or maybe the firmware itself should have the SKU number in it?

Oh thank you indeed I missed that the udevadm wait command needs udev v251 or later. Your udev is probably older than that? The script should be able to detect that.

Yes, that is required to build the lpc firmware.

1 Like