Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Board support for STM8S105K4T6 Development Board #17

Closed
KenjutsuGH opened this issue Sep 28, 2017 · 11 comments
Closed

Request: Board support for STM8S105K4T6 Development Board #17

KenjutsuGH opened this issue Sep 28, 2017 · 11 comments
Milestone

Comments

@KenjutsuGH
Copy link
Contributor

KenjutsuGH commented Sep 28, 2017

I was wondering how difficult it would be to add support for the STM8S105K4T6 Development Board?

Schematic:
document-page-001

Actual board:
stm8s105k4t6-pinout-board 1

In boards.txt I propose the following:

stm8sblack.name=STM8S105K4T6 Breakout Board

stm8sblack.upload.using=stm8flash
stm8sblack.upload.protocol=stlink
stm8sblack.upload.mcu=stm8s105?4
stm8sblack.upload.maximum_size=16384

stm8sblack.build.mcu=STM8S105
stm8sblack.build.f_cpu=16000000L
stm8sblack.build.core=sduino
stm8black.build.variant=stm8sblack

# meaningless variables just to keep the makefile happy

stm8sblack.upload.speed=1

I'm struggling with an appropriate pins_arduino.h file. I drew up the following pinouts:
stm8sblack pins.xlsx

Any advice on how to proceed?

@tenbaht
Copy link
Owner

tenbaht commented Oct 3, 2017

Good find, thank you for pointing out this board! I immediately ordered a few to play with but it will take a month for them to arrive here.
The CPU is almost identical to the STM8S103, just more flash, more RAM and more I/O (and a slightly higher power consumption). So adding support should be very easy. The hardest thing will be to decide on a numbering scheme for pins_arduino.h. I posted my general thoughts about this topic
on the project website or the project wiki (need to cleanup this documentation mess and duplication, btw)

After working on this project for a while I more and more feel that the hole idea of Arduino-like pin numbers is more in the way than actually helping the beginner. It just adds another level of indirection and table lookup to programming and wiring.

In most cases I find it more convenient to use the pin names like PA1 as printed on the breakout board instead of looking up the pin numbering diagram to find out which number this is defined as. In this case it simply doesn't matter anymore which numbers are used internally.

I am thinking of totally giving up on this half-Arduino-like scheme and either go for a very strict breakout board-specific geometical scheme or, even futher, go for a simple algebraic scheme as it is done for the ATxmega series: PA0..7 is pin 0..7, PB0..7 is pin 8..15 and so on, no matter if this pin even exists for the used CPU. To allow for easier porting between different breakout boards and CPUs it might be helpful to define functional pin names on top of this (PA0, PA1, TX, MOSI, A0 etc) and nobody has to care about numbering schemes anymore.

The major downside I see on this approach is breaking libraries that make hard coded assumptions about pin numbers. Especially the pin number 0 for the serial pin is often treated special or used as a marker for an unused function/pin. Lines like if (pin) {...} or if (pin>1) {...} are quite common even in the stock arduino code. This might be a problem in some cases, so I resisted from do it yet.

So, the conclusion is: I don't see the one right way to number the pins. In general I am more satisfied with the more regular numbering scheme for the Discovery board than the scattered scheme for stm8sblue. Maybe use that as a blueprint?

@zoomx
Copy link

zoomx commented Oct 4, 2017

I believe that the PxN approach is the best since many board exists. On STM32duino there is the same approach for the same reason (exception of MapleMini boards since it has a differen numeration on the board). Also Energia and ESP8266 (exception is Wemos boards) uses the same approach.

@tenbaht
Copy link
Owner

tenbaht commented Oct 8, 2017

in issue #19 roybaer pointed me to his design of an STM8S105K6-based board with Arduino-UNO r3 compatible connectors. I just added support for his suggested pinout to the new experimental branch of my code as board s8uno. This code is completely untested but should work for this chinese board as well.

It uses a strict functional pin mapping which makes a lot of sense with roybaer's PCB layout. Additionally, generic pin names PxN are supported, which would make sense for the china board. Maybe this is a useful approach to avoid too many different board definitions?

The alternative would be a new board definition for generic S105K CPUs using a strictly generic pin numbering scheme PA0..7 -> 0..7, PB0..7 -> 8..15 etc. But I am afraid of getting too many very similar board definitions which would only confuse people.

@KenjutsuGH
Copy link
Contributor Author

Thank you @tenbaht, I will test it later this week on my stm8black board (time permitting) :)

@speedbug78
Copy link

Just to throw my name in the hat, I plan to use this board (OP's board) as well. PxN names are preferable to me, but any method is ok as long as it is well documented and easy to find.

@tenbaht tenbaht added this to the 0.4.0 milestone Nov 9, 2017
@tenbaht
Copy link
Owner

tenbaht commented Dec 6, 2017

At issue #22 dubelectro posted a pin definition for this board and today I tried to integrate that definition for stm8sblack.

He chose a strict geometrical pin mapping that is very intuitive for working on a bread board. But the way it's done means that there is an overlap between the digital pin numbers and the analog channel numbers which might break some sketches.

To avoid that, I suggest to turn the numbering order around and do it the same way it would be done on a DIP package. Using the USB connector as a pin 1 marker and defining that as the top side, we could start at the top left with GND, 5V, and PC3 down to PD7, go to the other side RST, PA1 up to 3V3 and GND. This way the analog pins get high numbers.
What do you think?

@KenjutsuGH
Copy link
Contributor Author

@tenbaht I think that is a good idea

@dubelectro
Copy link
Contributor

I agree with your opinion. I was wondering what to do with the direction, but based on the diagram provided by the board developer. There is no special intention. I think that there are probably other problems as well, so I want them to be improved.

@aryeguetta
Copy link

Hi, Any update on that board? I was thinking of getting a couple to work with and test. Should I do that? thank you

@tenbaht
Copy link
Owner

tenbaht commented Nov 23, 2018

I finally pushed the commits to integrate support for this board. Most of that work was sitting on my hard drive for a long time already, but now I found the time to finish it up.
I changed the numbering scheme as discussed here in this thread and updated the pinout diagrams accordingly.
Please open new issues if you run into problems using this board. Good luck!

@tenbaht tenbaht closed this as completed Nov 23, 2018
@aryeguetta
Copy link

Hi, I have got two that I can NOT make them work at all - I opened an issue (No. #74)
Please assist on the errors I am getting - Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants