forum.hobbycomponents.com
http://forum.hobbycomponents.com/

STM8S105K4 Development board (HCDVBD0018)
http://forum.hobbycomponents.com/viewtopic.php?f=87&t=1576
Page 1 of 1

Author:  admin [ Tue Apr 29, 2014 6:00 pm ]
Post subject:  STM8S105K4 Development board (HCDVBD0018)

Image




This development/breakout board (HCDVBD0018) is based around the ST Microelectronics S105K4 microcontroller. STM8 microcontrollers are an ultra low cost solution to embedded control. This development board provides convenient access to the devices I/O pins via standard 2.54mm pitch headers. Besides providing access to most of the microcontrollers I/O, there is additionally a microUSB connector for powering from a USB port, and a standard ST SWIM programming/emulation header that allows for programming or debugging using a compatible programmer such as our low cost ST-Link compatible USB programmer (HCDVBD0016). An on-board 3.3V regulator provides power to the board ans is supplied via the 5V USB or 5V header pins. The ST tool chain (STVD) is available as a free download from the ST website and is fully compatible with this board. There are also additional third party tools such as the Cosmos ANSI C compiler (8K limited) and the SDCC (Small Device C Compiler) which can be downloaded for free. Links to these tools are provided at the bottom of this post.


Image


Order Yours Here.

16 MHz advanced STM8 core with Harvard architecture and 3-stage pipeline
Extended instruction set
Medium-density Flash/EEPROM: Program memory 2 Kbytes Flash; data retention 20 years at 55 °C after 10 kcycles Data memory 1Kbytes true data EEPROM; endurance 300 kcycles
RAM: 2 Kbytes
2.95 to 5.5 V operating voltage
Flexible clock control, 4 master clock sources: Low power crystal resonator oscillator External clock input Internal,user-trimmable 16 MHz RC Internal low power 128 kHz RC
Clock security system with clock monitor
Power management: Low power modes (wait, active-halt, halt) Switch-off peripheral clocks individually
Permanently active,low consumption power-on and power-down reset
Nested interrupt controller with 32 interrupts
Up to 37 external interrupts on 6 vectors
2x16-bit general purpose timer, with 2+3 CAPCOM channels (IC, OC or PWM)
Advanced control timer: 16-bit, 4 CAPCOM channels, 3 complementary outputs, dead-time insertion and flexible synchronization
8-bit basic timer with 8-bit prescaler
Window watchdog, independent watchdog timers
UART with clock output for synchronous operation, Smartcard, IrDA, LIN master mode
SPI interface up to 8 Mbit/s
I2C interface up to 400 Kbit/s
10-bit, ±1 LSB ADC with up to 10 multiplexed channels, scan mode and analog watchdog
25 I/Os on a 32-pin package including 12 high sink outputs
Highly robust I/O design, immune against current injection
Embedded single wire interface module (SWIM) for fast on-chip programming and non intrusive debugging
96-bit unique ID key for each device




Image



Code:
/* FILE:    STM8S105_Blink_Example
   DATE:    30/03/17
   VERSION: 0.1
   AUTHOR:  Andrew Davies

A simple blink example that will flash an LED connected to
port E pin 5 continuously on and off. This program has been
written specifically for our development board HCDVBD0018

You may copy, alter and reuse this code in any way you like,
but please leave reference to HobbyComponents.com in your
comments if you redistribute this code. This software may
not be used directly for the purpose of selling products
that directly compete with Hobby Components Ltd's own range
of products.

THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO
WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY,
INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE,
ACCURACY OR LACK OF NEGLIGENCE. HOBBY COMPONENTS SHALL NOT,
IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES, INCLUDING,
BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL
DAMAGES FOR ANY REASON WHATSOEVER.
*/

#include "STM8S105K4.h"

main()
{
   unsigned int d;
   
   PE_DDR = 1 << 5; //Set port E pin 5 to an output
   PE_CR1 = 1 << 5; //Set port E pin 5 to a push-pull
   
   while (1)
   {
      for (d = 0; d < 40000; d++); //Delay ~ 1 second

      PE_ODR |= 1 << 5;   //Set port E pin 5 high
     
      for (d = 0; d < 40000; d++); //Delay ~ 1 second
     
      PE_ODR &= ~(1 << 5); //Set port E pin 5 low
   }
}






Software Tools:

Development tools can be downloaded from the ST website here: http://www.st.com/web/en/catalog/tools/ ... 807/SS1747

A direct link to the STVD development environment is available for download here: http://www.st.com/web/catalog/tools/FM1 ... 7/PF210567

And the STVP programming software is available for download here: http://www.st.com/web/catalog/tools/FM1 ... 7/PF210568

A free 8K limited version of the Cosmos C compiler which is supported by the STVD development environment is available for download here: http://www.cosmic-software.com/eval_kit ... m_eval.exe
We recommend installing the Cosmos C compiler before installing the STVD development environment.

Alternatively SDCC (Small Device C Compiler) is a free compiler that is compatible with the STM8 microcontrollers and can be downloaded here: http://sdcc.sourceforge.net/




FAQ:

When trying to use the debug feature in the STVD development environment I get the following error: gdi-error [40201]: can't access configuration database

Go to C:\Program Files (x86)\STMicroelectronics\st_toolset\stvd\dao\ and install the ST Toolset.msi

If you are running 64 bit versions of Windows 8/10 and installing the toolset above did not resolve the problem open up a DOS command prompt in admin mode and issue the following two commands:

Regsvr32 /u "C:\Program Files (x86)\Common Files\Microsoft Shared\DAO\DAO350.DLL"
Regsvr32 "C:\Program Files (x86)\Common Files\Microsoft Shared\DAO\DAO350.DLL"




Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do no provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.

Author:  philipp [ Fri Jul 31, 2015 2:11 pm ]
Post subject:  Re: STM8 Development boards (HCDVBD0017 HCDVBD0018 & HCDVBD0

I wrote a few tutorials for various STM8 boards at
http://colecovision.eu/stm8/
while none of those tutorials is written for the boards mentioned above in particular
(I do not have any of those boards yet), they might still be useful to
get started with STM8 development using SDCC with any board.

Philipp

Author:  philipp [ Thu Dec 24, 2015 3:39 pm ]
Post subject:  Re: STM8 Development boards (HCDVBD0017 HCDVBD0018 & HCDVBD0

I recently bought the HCDVBD0017 and HCDVBD0019 boards, and wrote tutorials for them that use free tools only (the C compiler SDCC and stm8flash).

One tutorial uses a timer to blink the LED exactly once per second:
For the HCDVBD0017: http://www.colecovision.eu/stm8/HCDVBD0017%20LED.shtml
For the HCDVBD0019: http://www.colecovision.eu/stm8/HCDVBD0019%20LED.shtml

The other tutorial prints "Hello, world" via RS232 (the tutorials use the HCCABL0015 USB to RS232 TTL Serial Interface Cable):
For the HCDVBD0017: http://www.colecovision.eu/stm8/HCDVBD0017%20Serial.shtml
For the HCDVBD0019: http://www.colecovision.eu/stm8/HCDVBD0019%20Serial.shtml

Philipp

P.S.: At the time I write this post, images are still missing in the tutorials for the HCDVBD0017 and HCDVBD0019 boards. I will create and add them when I find time while the weather gives me suitable lighting conditions.

Author:  barewires [ Thu Jun 15, 2017 10:33 am ]
Post subject:  Re: STM8S105K4 Development board (HCDVBD0018)

Just got eForth working on the STM8S105K4. Check out my other parallel successes with the STM8S003 and STM8S103

viewtopic.php?f=73&t=1900
viewtopic.php?f=87&t=2177
viewtopic.php?f=87&t=2178
viewtopic.php?f=87&t=2180

https://github.com/TG9541/stm8ef/releases look for stm8ef-bin.2.2.17.zip or higher version number.

The extracted hex code in code/out/STM8S105K4/STM8S105K4.ihx is for this STM8S105K4
The code/out/MINDEV/MINDEX.ihx is for the Minimum Development System aka STM8S103xxx based boards.
Burning a released hex file is far easier than trying to get it compiled with sdcc. :evil:

The hex dump shows the unique factory burned x and y die coordinates, wafer and lot number 48CD - 48D8 This is useful to identify projects on the go.
Code:
 
hex
$48CD $0C DUMP
48CD   0 37  0 4D  5 36 30 35 31 32 32 33  0  0  0  0  _7_M_6051223____ ok

hi
stm8eForth v2.2
 ok
words
IRET SAVEC RESET RAM NVM LOCK ULOCK ADC@ ADC! WORDS .S DUMP ALLOT VARIABLE CREATE DOES> ] IMMEDIATE : ; OVERT ." $" ABORT" AFT REPEAT WHILE AHEAD ELSE THEN IF AGAIN UNTIL BEGIN +LOOP LOOP DO NEXT FOR COMPILE [COMPILE] LITERAL CALL, C, , ' [ NAME> \ ( .( ? . U. TYPE U.R .R $"| CR SPACES SPACE KEY DECIMAL HEX <# SIGN HOLD #S # #> ERASE FILL CMOVE HERE COUNT +! DEPTH PICK 0= ABS NEGATE NOT 1+ 1- 2+ 2- 2* 2/ EXG */ */MOD M* * UM* / MOD /MOD M/MOD UM/MOD WITHIN MIN MAX < U< = DNEGATE 2DUP ROT ?DUP BG TIM BL OUT last '?KEY 'EMIT BASE - 0< OR AND XOR + UM+ I OVER SWAP DUP 2DROP DROP NIP >R R@ R> C! C@ ! @ B! 2C@ 2C! 2@ 2! EXIT EXECUTE LEAVE EMIT ?KEY TX! ?RX hi 'BOOT OUT! COLD ok

Author:  Alfredo [ Mon Jun 26, 2017 8:25 pm ]
Post subject:  Re: STM8S105K4 Development board (HCDVBD0018)

Nice :-)

A "TTL" serial interface adapter needs to be connected to PD5, PD6, and GND, and nothing should ever be connected to "VCAP" :-)

I just looked it up: the LED is connected to PE5 - it's supported by the OUT! word.

This means that the following "blinky" Forth code should work:

Code:
\ Blinky using the background task
\ To stop it type 0 BG !
: blinky TIM $40 AND 0= OUT! ;
' blinky BG !

Author:  barewires [ Mon Oct 16, 2017 9:45 am ]
Post subject:  Re: STM8S105K4 Development board (HCDVBD0018)

The solder bridge on IC pins 6 - 7 is intentional, adjacent to header pins PD4 - PD5

Author:  barewires [ Wed Oct 18, 2017 3:31 pm ]
Post subject:  Re: STM8S105K4 Development board (HCDVBD0018)

Running eForth on many of HC STM8S products, I highly recommend Thomas' excellent project.
https://github.com/TG9541/stm8ef

The STM8S series sold here (S003 in W1209, S103, S105) are functionally similar except for differing amounts of FLASH, RAM, EEPROM, I/O, package and pins and a few minor memory map differences. For all in tents and porpoises (my highschool geography teacher kept saying that?) they are the same.

S105K4 16K, 2K, 1K
S103F3 8K, 1K, 640
S003F3 8K, 1K, 128

NVM
: ww words ;
: uniqids105 $48CD $0C dump ;
: uniqid $4865 $0C dump ;
: eedump $4000 $27F dump ;
: eedumpS105 $4000 $3FF dump ;
: optdump $4800 $0A dump ;
: ramdump 0 $3FF dump ;
: ramdumpS105 0 $7FF dump ;
: intvectors $8000 $7F dump ;
: buffer $350 $4F dump ;
: flashdump $8080 $1F7F dump ;
: flashdumpS105 $8080 $3F7F dump ;
: gpiodump $5000 $7FF dump ;
: alldump CR uniqid CR eedump CR optdump CR intvectors CR gpiodump
CR buffer CR ramdump CR flashdump CR ;
RAM

HEX
eedumps105
4000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ________________
...
43F0 4F 43 54 31 37 20 32 30 31 37 0 32 32 31 37 0 OCT17 2017_2217_ ok

When I blast the chips with eForth I place the text date and version number in high eeprom for my own reference.
There is currently no way to see which version is loaded but I have requested this. I need the sub-minor number added so I can track which version I am running.
hi
stm8eForth v2.2
ok
One day it will hopefully be:
stm8eForth v2.2.17.xxx

Filling eeprom requires unlocking memory.
ULOCK
4000 7EF 41 FILL \ note FILL does not write to the final location, bug or feature?
LOCK

eedumpS105
4000 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
...
47E0 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 0 AAAAAAAAAAAAAAA_
47F0 4F 43 54 31 37 20 32 30 31 37 0 32 32 31 37 0 OCT17 2017_2217_ ok

The beauty of eForth is being able to change built-in words to suit, by adding new words for testing or even over-writing factory words.
HEX
NVM
: myfill ULOCK SWAP 1 + SWAP FILL eedump LOCK ;
RAM
4000 3F 39 myfill

LOCK \ when finally done writing to eeprom

Filling / erasing flash requires NVM (non volatile memory) to be turned on and then turned off by RAM.
HEX NVM $F000 $FFF $88 myfill RAM
$F000 $FFF DUMP
F000 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 ________________
...
FFF0 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 ________________ ok

Note that any careless excursion writing into system flash or RAM, or confusing decimal / hex can result in a corrupted eForth, maybe not right now but when that code is eventually accessed. This then will require re-flashing using the STM8 & STM32 Emulator and Programmer Model HCDVBD0016

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/