Author Topic: How far up the code stack should I start?  (Read 986 times)

0 Members and 1 Guest are viewing this topic.

Offline set321goTopic starter

  • Newbie
  • Posts: 8
  • Country: ca
How far up the code stack should I start?
« on: May 07, 2019, 06:13:16 pm »
Looking to write a microcontroller application, I'm building a rowing computer so first version is usb, accelerometer, display, sd card. The general concept is read sensor data do some math and store it to memory & display it on screen. At some later time offload the data via usb. The SD card was a shortcut idea to avoid the usb data part on the initial go around. I'm planning to use an STM32F0 to start with. I have a SW background so I'm kinda struggling with the whole 'roll your own' approach for everything.

I'm pretty certain I need a bootloader as I want to flash firmware updates via usb. What are my options here? I found OpenBootloader but that was about it, is there anything else worth looking at?

I looked around for some kinda OS and came across the concept of RTOS, i think this is probably a bit to much for my needs but is there other maybe less heavy loop/scheduler type frameworks? (i'm hopefully searching for the wrong terms which is why i can't find much)
« Last Edit: May 07, 2019, 06:34:17 pm by set321go »
 

Offline Domagoj T

  • Frequent Contributor
  • **
  • Posts: 505
  • Country: hr
Re: How far up the code stack should I start?
« Reply #1 on: May 07, 2019, 06:29:13 pm »
It would probably help if you told us what is the microcontroller supposed to do.
 

Offline set321goTopic starter

  • Newbie
  • Posts: 8
  • Country: ca
Re: How far up the code stack should I start?
« Reply #2 on: May 07, 2019, 06:34:46 pm »
It would probably help if you told us what is the microcontroller supposed to do.

Good idea! Updated my post with some details.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4209
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: How far up the code stack should I start?
« Reply #3 on: May 07, 2019, 08:04:05 pm »
Looking to write a microcontroller application, I'm building a rowing computer so first version is usb, accelerometer, display, sd card.
...
I'm planning to use an STM32F0 to start with.

I looked around for some kinda OS and came across the concept of RTOS, i think this is probably a bit to much for my needs but is there other maybe less heavy loop/scheduler type frameworks?
That a lot of things at once, for an F0... as a beginner... It you only have a text display, it's probably fine.

An RTOS can help you handle the concurrency of the above tasks. Otherwise you'd have to police yourself that the code doesn't wait somewhere too long and fix interrupt priorities. Which an RTOS can ease for you. But it can also complicate things when you still manage to do it wrong.

I've not been using ChibiOS for a while, but they used to be very much oriented around STM32 chips. You might even find compilable STM32F0 SD card examples, that'll ease your job a lot!
 

Offline set321goTopic starter

  • Newbie
  • Posts: 8
  • Country: ca
Re: How far up the code stack should I start?
« Reply #4 on: May 07, 2019, 08:30:03 pm »
Looking to write a microcontroller application, I'm building a rowing computer so first version is usb, accelerometer, display, sd card.
...
I'm planning to use an STM32F0 to start with.

I looked around for some kinda OS and came across the concept of RTOS, i think this is probably a bit to much for my needs but is there other maybe less heavy loop/scheduler type frameworks?
That a lot of things at once, for an F0... as a beginner... It you only have a text display, it's probably fine.

An RTOS can help you handle the concurrency of the above tasks. Otherwise you'd have to police yourself that the code doesn't wait somewhere too long and fix interrupt priorities. Which an RTOS can ease for you. But it can also complicate things when you still manage to do it wrong.

I've not been using ChibiOS for a while, but they used to be very much oriented around STM32 chips. You might even find compilable STM32F0 SD card examples, that'll ease your job a lot!

Well i'm going to attack things in stages and I've already prototyped that setup out on an arduino mkr board.

1. Microcontroller talking to accelerometer using i2c
2. Add display text i2c
3. Add sd card data write over spi
4. usb... (not looking forward to this bit).

Is an RToS the right term? Or should i be looking for something else to help with interups and scheduling?
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4209
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: How far up the code stack should I start?
« Reply #5 on: May 07, 2019, 08:58:28 pm »
Looks like only the accelerometer is a “realtime” task. For best results you want low jitter on the measurement. This means you could do it with one interrupt, and the rest in the superloop.

USB also requires realtime reaction, but this is usually handled in the ISR of the driver.

In a superloop you’d be making software timers anyway. An rtos can only help you with this. And then after that you have learned how an rtos works!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf