Hello from Finland

Generic boards that are not Maple or Maple mini clones, and don't contain the additional USB reset hardware
Post Reply
turboscrew
Posts: 44
Joined: Fri Mar 10, 2017 7:36 pm

Hello from Finland

Post by turboscrew » Fri Mar 10, 2017 8:04 pm

I wonder if I'm in a wrong place after all.
I've been writing bare metal stuff for a blue pill for a couple of months now.
I haven't used Arduino IDE and I don't use any libraries either. I use C and assembly.
The reason for my registering was that maybe I could get some help with understanding the HW of a blue pill,
but when I went through the FAQ I saw that this place is about using Arduino IDE and/or Arduino libraries.

Should I go somewhere else, and if, does anyone know a site about blue pills?

User avatar
RogerClark
Posts: 6726
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Hello from Finland

Post by RogerClark » Fri Mar 10, 2017 9:14 pm

Welcome

If you have questions about the STM HAL or the Standard peripheral library, you will probably get a more detailed response from STM's own forums

But we have some members who use the HAL as well as the Arduino core.

STM now have their own Arduino core which uses the HAL as its base.

If you want information on the BluePill hardware, I think this may be the best place for that, as loads of people use that board, so are very familiar with its hardware design

turboscrew
Posts: 44
Joined: Fri Mar 10, 2017 7:36 pm

Re: Hello from Finland

Post by turboscrew » Fri Mar 10, 2017 11:21 pm

Thanks. So I AM in the right place!?

Like I mentioned, I don't use any libraries - not even C standard libraries.
I want to learn the HW interface of the blue pill.

This far USART works fine, sysclock runs fine, RTC works fine - both with LSI and LSE, and GPIOs with
interrupts (EXTI-interrupts) work fine. Going to standby and waking up by RTC work also fine.
With those I might be of help.

But I seem to have problems with timers. The time base works fine, but I haven't managed to get
output compare and input capture to work.
There are plenty of examples, but they all use the CMSIS library or similar, and following the code from
file to another in different directories is awkward. And it still doesn't tell you whether there are
required order of things or not.

Ollie
Posts: 183
Joined: Thu Feb 25, 2016 7:27 pm

Re: Hello from Finland

Post by Ollie » Sat Mar 11, 2017 3:10 am

Turbo,

I do fully understand your thinking. Some years ago, I was in similar position in learning STM32F4xx. I did end writing a tutorial about the ideas of replacing SPL with your own streamlined code. For that work, the STM manuals did work quite well for me. I do expect that you will get the most accurate answers to your detailed questions.

Obviously the manuals are not able to tell the strategies and tactics in using the STM32F1xx registers. For that there is no real alternative for trial and error. A high speed oscilloscope and logic analyzer are mandatory for time sensitive analysis. This is an essential part of the timer based applications. Instead of print statements, your code must update the GPIO pins to reveal the internal activities.

I do highly recommend the Saleae logic analyzers for that work.

Cheers, Ollie

User avatar
RogerClark
Posts: 6726
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Hello from Finland

Post by RogerClark » Sat Mar 11, 2017 4:46 am

turbo

The core API that is in my repo, was originally written by Leaflabs and does not use the SPL or the HAL, you may find it useful to look at the code in the core and see if you can re-use any of it, to do your bare metal programming.

You could also look at LibOpenCM3, but that may use the Standard Peripheral Library (http://libopencm3.org/ )

zmemw16
Posts: 1380
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: Hello from Finland

Post by zmemw16 » Sun Mar 12, 2017 2:36 pm

it does use the SPL, similar to, but derived / forked from libopencm3 is unicore-mx.

if you get either of those, ensure that you pull the latest library code into the examples package. building those with the library version in the examples failed for me.

stephen

turboscrew
Posts: 44
Joined: Fri Mar 10, 2017 7:36 pm

Re: Hello from Finland

Post by turboscrew » Thu Mar 16, 2017 12:31 am

Ollie wrote:Turbo,

I do fully understand your thinking. Some years ago, I was in similar position in learning STM32F4xx. I did end writing a tutorial about the ideas of replacing SPL with your own streamlined code. For that work, the STM manuals did work quite well for me. I do expect that you will get the most accurate answers to your detailed questions.
Yep. Figured the timer problem out - somehow I missed the TIM_RCR register (that's not present in general purpose timers), so I ended up writing compare values in it and reading capture values from it. :lol:
Now DHT-22 reading using the input capture to receive the data, works fine.
Obviously the manuals are not able to tell the strategies and tactics in using the STM32F1xx registers. For that there is no real alternative for trial and error. A high speed oscilloscope and logic analyzer are mandatory for time sensitive analysis. This is an essential part of the timer based applications. Instead of print statements, your code must update the GPIO pins to reveal the internal activities.

I do highly recommend the Saleae logic analyzers for that work.

Cheers, Ollie
The Saleae-compatible logic analyzer is still in the mail. (It should arrive any day now.)

Post Reply