|flabbergast 0d8bc62180||1 year ago|
|README.md||1 year ago|
|bat-extras.fs||1 year ago|
|dump.fs||1 year ago|
|hal-stm32f04.fs||1 year ago|
|hal-stm32f07.fs||1 year ago|
|mecrisp-2.5.0-bat064-f072usb.bin||1 year ago|
|mecrisp-2.5.0-bat128-f072usb.bin||1 year ago|
|usb.fs||1 year ago|
|usbbase-f042.fs||1 year ago|
|usbbase-f072.fs||1 year ago|
This is a modification of Jean-Claude Wippler's “Serial USB driver for Forth” - see his blog post. He has done a really amazing job of getting this running in the first place; in his case for F103-based devices. I have modified it so that it runs on F072; the primary target for me is the bat board with STM32F072CxT6.
The assumption is that it runs on a clean Mecrisp Stellaris image, ideally with
jcw's ‘spezial’ modification (there are binaries available in this repo in
cores). (The only consequence of using the standard Mecrisp Stellaris is that
USARTx does get initialised; it doesn't on ‘spezial’.)
So, getting this on the board requires:
usbbase-f072.fs(with folie, otherwise you'll need to manually resolve the
resetthe board, no USART console shows up, and the device should enumerate as an USB ACM device, over which you should be able to talk to Mecrisp.
This is a bit tedious, so instead you can just upload
mecrisp-2.5.0-bat128-f072usb.bin (or ...
bat064... if you have 64kB F072)
from this directory - it is the result of the above process, with Mecrisp
Stellaris 2.5.0 core with ‘spezial’ patch. This can be done either over USART,
or over USB with
dfu-util - the latter is convenient in that no USB-to-serial
converter is necessary at all, since everything happens over USB.
There is also a version for STM32F042 here; the assumption is the TSSOP-20 package (so STM32F042F6P6, like this board). Just a few differences:
USART2can not be clocked from HSI, so changing the main clock on these requires changing
BRR(baud rate) to keep a serial console.
See also the details about all this (for F103) in jcw's original README.
eraseflash will keep the USB driver/console in, but
erases the USB driver and goes bat to a clean Mecrisp (USART console only). The USB
driver takes up 6kB of flash. Note that a clean Mecrisp runs the prompt on a particular
USART (that was determined when Mecrisp Stellaris was compiled). My images run with TX/RX
on PA9/PA10, USART1, 115200 baud.
Finally, clean Mecrisp Stellaris doesn't mess with the clock, so the chip runs on 16MHz, clocked from HSI oscillator (high-speed internal). To get USB running, the driver switches to 48MHz (clocked from HSI, multiplied by PLL). The USB is clocked from HSI48 which is being automatically trimmed to the precision required by the USB through “clock recovery system”, timed from SOF USB packets.
There were a few snags porting from F103 to F072; the main difference is the addressing of the ‘packet memory’ between F1 and F0x2 chips, and fixing a couple of omissions in the original driver.