among the things, have you tried a 'simple' sketch such as
Code: Select all
void setup() {
Serial.begin();
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
Serial.println("hello world");
digitalWrite(LED_BUILTIN, ! digitalRead(LED_BUILTIN));
delay(1000);
}
a blinky is customary 'hello world' in the Arduino world.
the led should at least blink. if your led is not the same as the 'customary' e.g. blue pill (PC13) or maple mini (PB1), replace that LED_BUILTIN macro with the appropriate pin for your board.
In libmaple core
SERIAL_USB is defined by default in
boards.txt.
Hence, in the above example, you should at least see a device connected with id '
1eaf:0004', that is a USB CDC ACM device, i.e. USB Serial.
In Windows, it may be necessary to work through the install steps to have the virtual com port properly recognized.
https://github.com/rogerclarkmelbourne/ ... stallation
I'm not too sure if things could have changed as that is written back then when Windows 7 is the most common OS.
And after you connect in your serial monitor/terminal e.g. the Arduino serial monitor you should see at least the "hello world" being printed repeatedly.
I prefer to use putty for the serial monitor
https://www.chiark.greenend.org.uk/~sgtatham/putty/
As in libmaple core
SERIAL_USB is defined by default in
boards.txt.
If you are playing with USB composite, it may help to look in your
boards.txt copy and comment the line that sets
SERIAL_USB and use a line without the SERIAL_USB flag. e.g.
Code: Select all
#genericSTM32F103C.menu.upload_method.DFUUploadMethod.build.upload_flags=-DSERIAL_USB -DGENERIC_BOOTLOADER
genericSTM32F103C.menu.upload_method.DFUUploadMethod.build.upload_flags=-DGENERIC_BOOTLOADER
and there is another thing, if you use that maple DFU loader, you need to install the bootloader
https://github.com/rogerclarkmelbourne/ ... bootloader
first hand using st-link or the serial uart upload method
viewtopic.php?t=1642
Otherwise, you would need an st-link or usb-uart dongle (and setting boot0) to update your sketch each time as your sketch is the only firmware on board
viewtopic.php?t=1642
this way using an st-link or ( usb-uart and setting boot0 ) is probably preferred if you are testing out usb codes.
As the usb dfu boot loader would first enumerate the port e.g. with id
1eaf:0003 and later jump to your sketch and your sketch needs to enumerate the port again. Often, you need to do a
*usb reset* by pulling D+ and D- low for like 10ms.
so called single ended zero
https://www.usbmadesimple.co.uk/ums_3.htm
this is so that the host would enumerate the ports again and register your new midi device.
if you do without the USB DFU boot loader, this is simplier as you won't land in this situation.
there are actually (many) other things, you need to select a board that is a close match to your board preferably exact or 'compatible'
e.g. STM32F103RC (48k RAM. 256k Flash) etc
that is not all, the old 'maple mini' and 'blue pill' boards use a 'default' crystal frequency of 8 Mhz
if you used anything different, you may need to dig into setting up the clocks
https://github.com/rogerclarkmelbourne/ ... e/rcc_f1.c
and in addition for each different variant / board / chip
the memory size
https://github.com/rogerclarkmelbourne/ ... 2f103rc.ld
and layout (e.g. start address is different), e.g. with a maple DFU bootloader it would offset away from 0x8000000
https://github.com/rogerclarkmelbourne/ ... tloader.ld
this need to match if you are after all using e.g. the maple DFU bootloader (e.g. roger's version)
https://github.com/rogerclarkmelbourne/ ... ader_20.ld
there are also alternative ways to build a sketch such as using a Makefile
viewtopic.php?t=37
this could be a deeper dive for beginners, but that I use it only because I work in Eclipse rather than Arduino IDE.
It is also probably different from Arduino IDE in terms of the flags. Very often, for starters you may need to edit the Makefile to define where is your arm-gcc-none compiler etc and that it probably works mainly in Linux.
on Windows, try using WSL if you want to work it that way
https://learn.microsoft.com/en-us/windows/wsl/install