Electronics > Microcontrollers

Experimenting with a STM8 MCU

(1/7) > >>

MathWizard:
I'm getting more familiar with MCU's on the hardware level, and today I have a STM8S003F3P6 on a breakout board. It was from an ebay temperature sensor. There was no external memory.


For now I don't want to try using some IDE to talk to it, or even with Arduino and it's IDE, I'm pretty new to all that too.

I have a few STM8 pdf's and links open, but I feel pretty lost.

I just want to put it in some reset state, using hardware on a breadboard, so it's not running it's internal code, and just try sending it simple op-codes, just for simple things like to read some memory address, or some status register. Just so they feel real.

IDK if that means I have to send commands over I2C from Arduino, or with Bus pirate. Or can I do it with an 8bit shift register and 555 timer circuits I have made up that could send bits to some port. ??

Maybe this is what SWIM is for? Single wire interface module (SWIM) and debug
module (DM). Or UART ??

Or maybe this is a bad MCU to try doing anything by hand ?? (I don't mean UART or anything complicated....I mainly just what to read from some memory addresses)

HwAoRrDk:
You can't "send" it op-codes. It has internal flash memory for program storage - it doesn't use external memory, there is no external bus. Your code needs to be programmed (via the SWIM interface) to flash before it will execute anything. If it's a pre-programmed chip salvaged from an existing board, unless you erase it and re-program it, it will simply execute the code it already has in flash.

(Technically speaking, seeing as the STM8 can execute code from RAM, you could write code to RAM via SWIM debugger and tell it to jump to and run that, but that would be a complicated exercise.)

Do you have an ST-Link programmer device? If not, you need one to program the chip. A cheap $5 clone ST-Link/V2 from eBay/Amazon/AliExpress should suffice (although I should mention I've heard STM8 support on the clones is sometimes hit-and-miss). Unfortunately the STM8S003 does not have a built-in UART bootloader ROM, so you can't program it via UART like you can with other chips in the range (see the stm8gal utility for that).

Do you want to program it in assembly or C? Either way, a good place to start is with the SDCC compiler. It includes an assembler too. The assembly instruction set is pretty easy - very similar to the old Motorola 6809.

If you are trying to run the bare chip on a breadboard, note that you need to connect a 1uF capacitor between the VCAP pin 8 and ground.

ksjh:
When I started to experiment with STM8 devices, I followed this blog post:
https://lujji.github.io/blog/bare-metal-programming-stm8/
I found it quite easy to follow, even when you have never been working with this architecture before.

tszaboo:
I tried it a year ago. You need to request a time limited, computer locked license from a French company in an email to get started. Then there are no examples whatsoever online, so figure out everything yourself.
I just put the eval boards to a cabinet, and decided to used something that is easier to program.

rhodges:
You can use my STM8 libraries and example programs to get started:
https://github.com/unfrozen

If your board is the W1209 temperature sensor, I have a library for the LEDs, keys, and relay. ("lib_w1209.c")

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod