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

Caveat about memory layout #3

Open
midnight-wonderer opened this issue Aug 20, 2015 · 5 comments
Open

Caveat about memory layout #3

midnight-wonderer opened this issue Aug 20, 2015 · 5 comments

Comments

@midnight-wonderer
Copy link

Continued from issue #2
When I investigate further.
I found that the code is misleading.
Here the issue

CLK_DIVR = 0x00; // Set the frequency to 16 MHz

When I read this line I perceive that master frequency is set to oscillator frequency but it actually is not.
Because memory offset of my device is different than the example.
Check page 34 of this reference.
Which is entirely different from your defined SFR
And since people who interested in this repo are mostly beginners just want to get started on stm8. Chance are they (me too) don't aware of the issue.

You'd better add some caveat about the SFR definition to the repo probably in the code comment.

@rohitk-singh
Copy link

Hi,
Actually, the header file by @vdudouyt is for STM8L series. And you are using STM8S series. It probably just-works for LED Blinky and simpler projects, but would fail for peripherals with different memory mapped addresses.

@midnight-wonderer
Copy link
Author

I don't even know there is l serie exist. That why I don't understand the l suffix of file name. Totally beginner.

@BobRyan530
Copy link

BobRyan530 commented Mar 25, 2017

I've modified the header to match the stm8s series.
https://github.com/BobRyan530/stm8s/blob/master/stm8s.h

Note that I renamed the USART_xx registers to UART_xx to match the datasheet. Other than that some of the register values were adjusted but the names remain the same.

@midnight-wonderer
Copy link
Author

@BobRyan530 nice work
I actually maintain my own version of stm8s header for the time being.
https://github.com/MidnightWonderer/stm8-header
I defined only what I use, though.
If you interested I can add what you use via pull request.
I try to conform to the datasheet and the original header as possible so I use base addresses and offsets.
stm8l is actually welcome too I just haven't use it yet.

@BobRyan530
Copy link

BobRyan530 commented Mar 27, 2017 via email

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

3 participants