Unable to build the firmware
Closed this issue · 21 comments
Hi!
I managed to assemble the hardware for this and I am now trying to get the firmware built but I am not having any luck. Can you provide a bit more information on the versions of the libraries that were used? Or maybe even provide a pre-built bin file that can be flashed onto the board?
I've downloaded the latest versions of the Arduino_STM32 that was linked on the hackaday project, I am also using the latest versions of other libraries that are used and I am getting the following errors when I am trying to compile the firmware source:
/Users/roli/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_I2CDevice.cpp: In member function 'bool Adafruit_I2CDevice::write(const uint8_t*, size_t, bool, const uint8_t*, size_t)':
/Users/roli/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_I2CDevice.cpp:88:47: error: invalid conversion from 'const uint8_t* {aka const unsigned char*}' to 'uint8* {aka unsigned char*}' [-fpermissive]
if (_wire->write(prefix_buffer, prefix_len) != prefix_len) {
^
In file included from /Users/roli/Documents/Arduino/hardware/Arduino_STM32/STM32F1/libraries/Wire/Wire.h:42:0,
from /Users/roli/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_I2CDevice.h:1,
from /Users/roli/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_I2CDevice.cpp:1:
/Users/roli/Documents/Arduino/hardware/Arduino_STM32/STM32F1/libraries/Wire/utility/WireBase.h:123:12: note: initializing argument 1 of 'size_t WireBase::write(uint8*, int)'
size_t write(uint8*, int);
^~~~~
/Users/roli/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_I2CDevice.cpp:97:31: error: invalid conversion from 'const uint8_t* {aka const unsigned char*}' to 'uint8* {aka unsigned char*}' [-fpermissive]
if (_wire->write(buffer, len) != len) {
^
In file included from /Users/roli/Documents/Arduino/hardware/Arduino_STM32/STM32F1/libraries/Wire/Wire.h:42:0,
from /Users/roli/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_I2CDevice.h:1,
from /Users/roli/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_I2CDevice.cpp:1:
/Users/roli/Documents/Arduino/hardware/Arduino_STM32/STM32F1/libraries/Wire/utility/WireBase.h:123:12: note: initializing argument 1 of 'size_t WireBase::write(uint8*, int)'
size_t write(uint8*, int);
^~~~~
Multiple libraries were found for "Wire.h"
Used: /Users/roli/Documents/Arduino/hardware/Arduino_STM32/STM32F1/libraries/Wire
Not used: /Users/roli/Documents/Arduino/hardware/Arduino_STM32/STM32F1/libraries/WireSlave
Multiple libraries were found for "USBComposite.h"
Used: /Users/roli/Documents/Arduino/hardware/Arduino_STM32/STM32F1/libraries/USBComposite
Not used: /Users/roli/Documents/Arduino/libraries/USBComposite_stm32f1-0.99
exit status 1
Error compiling for board Generic STM32F103C6/fake STM32F103C8.
Hi! Looks like these errors are due to using the Adafruit_BusIO library. I just noticed that this library is now a dependency for the Adafruit GFX lib. I am still using Adafruit GFX version 1.7.5 which does not have this dependency.
In any case I've added a binary file for the STM32F103C8: keybon.generic_stm32f103c.zip
EDIT: I am getting the same errors after updating Adafruit GFX and installing Adafruit_BusIO. If reverting to 1.7.5 works for you I will add this to the project description.
Awesome. Thanks. Yes, reverting to 1.7.5 did enable me to build the project.
I am still having issues uploading it though. I've uploaded the bootloader (generic_boot20_pc13.bin) as suggested but the thing still doesn't show up on my computer when I plug in the USB. Just to double check - should any of the BOOT0/BOOT1 be shorted while trying to upload a new binary - after the initial bootloader is uploaded that is?
BOOT1/BOOT0 should be left open (connected to GND via resistors).
With the bootloader the STM32 should show up as a virtual COM port.
What hardware are you using - a bluepill board or the keyboard from this project?
The bluepills are notorious for having a hardware error that causes USB problems: http://amitesh-singh.github.io/stm32/2017/05/27/Overcoming-wrong-pullup-in-blue-pill.html
Well this is fun. Mine doesn't show up at all.
I am using the board/components from this project. As always could be an issue with my soldering somewhere.
OK, cool, soldering these USB-C connectors can be tricky. Try double checking the connections and maybe use a multimeter for continuity testing. We're going to get this to work! 😄
Hmmm. I've tried plugging it into a windows machine since that is usually more lenient towards weird USB devices. And windows does actually detect it. Although I get an "unknown device" and if I check it on the control panel I get: "device descriptor request failed".
Did you install the drivers from the Arduino_STM32 folder? Maybe a reinstallation can fix it.
Based on the error and the fact that it is not recognized by my Mac at all I would guess that it is either some sort of hardware or firmware issue. The fact that I now can't even re-install bootloader through serial has me worried.
EDIT: Well after some poking around I finally managed to get the flasher thingy to re-connect and re-upload the bootloader. I've also scoped out the oscilator and it seems to be oscilating at 8MHz. So the chip seems to be booting fine since it's running the clock. It looks like I have to do some checking around the USB part.
That's strange. Flashing the bootloader via serial should work no matter which sketch is running.
Are you sure the soldering connections are good? Can you maybe post a picture?
There are not many components involved in the USB interface. Your soldering looks very clean. The only thing I can't verify is the crystal and the right side of the STM32. Maybe the D+ or D- pins could use some more solder. Apart from that I have no idea.
The cap and resistors that are circled needed to be swapped. Apparently the designators are placed in a funny position. The board is now getting recognized as a Maple 003.
I am still getting issues uploading the FW though:
Sketch uses 40640 bytes (62%) of program storage space. Maximum is 65536 bytes.
Global variables use 8104 bytes (39%) of dynamic memory, leaving 12376 bytes for local variables. Maximum is 20480 bytes.
/Users/roli/Documents/Arduino/hardware/Arduino_STM32/tools/macosx/maple_upload cu.usbserial-00000000 2 1EAF:0003 /var/folders/96/d_b8vx8178l1twdc7zpmv5400000gn/T/arduino_build_749183/keybon.ino.bin /Applications/Arduino.app/Contents/Java
Failed to open serial device.
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
dfu-util: Invalid dfuse address: /Applications/Arduino.app/Contents/Java
An error occurred while uploading the sketch
dfu-util 0.8
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Opening DFU capable USB device...
ID 1eaf:0003
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #2 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Awesome! Sorry for the bad text placement! Does the same error occur on windows?
Almost there. Managed to get it to build on windows (looks like the dfu util version included in arduino_stm32 is a bit too old for newer versions of mac os).
Now on to the next problem...
Can you maybe tell me which version of the ssd1306 library you are using? Just so I can check that it's not that.
I know what's causing this. Actually I forgot about this until now - The Adafruit_SSD1306 library does not officially support this display resolution. I had to add a few lines to the Adafruit_SSD1306.cpp: Adafruit_SSD1306.zip
These are the changes:
Notice that the width is 128px while the screen only has 64. I had weird effects when using the actual resolution so this was a workaround. A side effect is that everything has to be shifted 32px to the right.
EDIT: Make sure to replace make the change on the library in Arduino/libraries, not the one inside the stm32 hardware folder. Arduino IDE might need to be restarted for the change to take effect.
Yep, that was it. Thank you for the help! Got it working now.
A few of the buttons didn't work because my pcb cleaner leaves weird sticky residue on the board and it messes with the switches. But soaking the thing in massive amounts of contact cleaner solved that as well. Now onto my next challenge of actually building an app that will work with this on mac os.
Cool! Thanks for posting the picture! I will add some more instructions to the projects so the next person building this will have a smoother experience.
May I ask where you bought the OLED screens from? LCSC is out of stock and I'm thinking of assembling another keyboard.
Awesome!
I bought them on AliExpress: https://www.aliexpress.com/item/32835519387.html?spm=a2g0s.9042311.0.0.2a274c4dEsgzVu
They are cheaper than the ones from LCSC as well which is nice.
Hi! Looks like these errors are due to using the Adafruit_BusIO library. I just noticed that this library is now a dependency for the Adafruit GFX lib. I am still using Adafruit GFX version 1.7.5 which does not have this dependency.
In any case I've added a binary file for the STM32F103C8: keybon.generic_stm32f103c.zipEDIT: I am getting the same errors after updating Adafruit GFX and installing Adafruit_BusIO. If reverting to 1.7.5 works for you I will add this to the project description.
你好!看起來這些錯誤是由於使用Adafruit_BusIO庫引起的。我剛剛注意到該庫現在是Adafruit GFX庫的依賴項。我仍在使用沒有此依賴項的Adafruit GFX版本1.7.5。
無論如何,我都為STM32F103C8添加了一個二進製文件:keybon.generic_stm32f103c.zip編輯:更新Adafruit GFX並安裝Adafruit_BusIO後,我得到相同的錯誤。如果恢復為1.7.5可行,我將其添加到項目描述中。