Hi,
I have a machine with four stepper motors to control to which I want to be able to expand connectivity later. This involves making the right choice at the outset. An RTOS solution like Chibios seems to be the way to go.
The machine control needed should be a fairly light load for STM32 hardware but it has to remain flawless when other peripherals are added. Motor step pulses will need maximum of 30kHz switching.
I'm a little unclear how SDIO would fit into this situation. There are certain SD operations, especially writes, that require significant time to complete and involve fairly large block transfers.
Will use of Chibios enable these operations to be run at the same time as machine control on a higher priority thread or could this lead to failure of the SDIO and the possibility of corrupted media?
Thanks.
machine control + SDcard
Moderator: RoccoMarco
Re: machine control + SDcard
Hello,
I work on pressure calibrator which use 2 stepper motors + SD card for settings save.
This for perfectly fine. High priority thread for regulation, and lower priority thread for GUI and also for filesystem.
I work on pressure calibrator which use 2 stepper motors + SD card for settings save.
This for perfectly fine. High priority thread for regulation, and lower priority thread for GUI and also for filesystem.
Re: machine control + SDcard
Many thanks for the reply Anubirux.
Is that an anecdotal report that it works for you. or is this something that WILL work in all situations?
I'm driving a fairly hefty CNC milling machine and this may be a faster, more stringent application than your pressure regulator. What I'm needing is a theoretical answer, not a specific application being OK. GUIs tend not to matter because, at worst, you get a glitch which probably goes unnoticed. It's certainly helpful to know that your SD works OK but what I need to know is whether it is guaranteed to work OK.
Could you be a little clearer on what kind of situation you are reporting here?
Is that an anecdotal report that it works for you. or is this something that WILL work in all situations?
I'm driving a fairly hefty CNC milling machine and this may be a faster, more stringent application than your pressure regulator. What I'm needing is a theoretical answer, not a specific application being OK. GUIs tend not to matter because, at worst, you get a glitch which probably goes unnoticed. It's certainly helpful to know that your SD works OK but what I need to know is whether it is guaranteed to work OK.
Could you be a little clearer on what kind of situation you are reporting here?
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: machine control + SDcard
Hi,
The RTOS ensures that tasks are executed strictly in priority order.
Everything else is application design, this article could be of help: http://www.chibios.org/dokuwiki/doku.ph ... s_concepts
If you need a demonstration, it is possible but with significant constraints: https://en.wikipedia.org/wiki/Rate-monotonic_scheduling
Giovanni
The RTOS ensures that tasks are executed strictly in priority order.
Everything else is application design, this article could be of help: http://www.chibios.org/dokuwiki/doku.ph ... s_concepts
If you need a demonstration, it is possible but with significant constraints: https://en.wikipedia.org/wiki/Rate-monotonic_scheduling
Giovanni
Re: machine control + SDcard
Thanks Giovanni .
I have read the RTOS intro. My question was more about the SDIO driver , though I was probably not clear about that.
I started looking into this and thought I'd read that there were certain ( relatively long ) operations that could not be interrupted. Maybe I misunderstood.
I have read the RTOS intro. My question was more about the SDIO driver , though I was probably not clear about that.
I started looking into this and thought I'd read that there were certain ( relatively long ) operations that could not be interrupted. Maybe I misunderstood.
Re: machine control + SDcard
I control my 3D printer with Chibios.
I use a STM32F417 and can print high resolution g-code files from the SD-card without problems.
The max. steprate is around above 100kHz. (Never tested it to the limit)
An CNC should be no problem.
I use a STM32F417 and can print high resolution g-code files from the SD-card without problems.
The max. steprate is around above 100kHz. (Never tested it to the limit)
An CNC should be no problem.
Re: machine control + SDcard
Thanks Erik. This is also anecdotal but similar to one of my objectives so very useful input.
What I'm trying to do is take a more engineered approach, rather than trail and error, works for me.
Later I want to add an I2C display and other peripherals, this suck up a lot of processor time.
At some stage, if the higher priority jobs take too much processor time , something will have to give in the SD layer.
Maybe I just need to take this from first principals and start digging through the SD standards spec. I was hoping to profit from some prior knowledge here. The comments so far have been useful , thanks.
What I'm trying to do is take a more engineered approach, rather than trail and error, works for me.
Later I want to add an I2C display and other peripherals, this suck up a lot of processor time.
At some stage, if the higher priority jobs take too much processor time , something will have to give in the SD layer.
Maybe I just need to take this from first principals and start digging through the SD standards spec. I was hoping to profit from some prior knowledge here. The comments so far have been useful , thanks.
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: machine control + SDcard
Anecdotal evidence is what you can get using the forum. This should give you enough confidence to attempt it and measure results.
You need to design so low priority task writing SD has enough time left from high priority tasks and ISRs. Decoupling the slow from the fast should do the trick and buffer speed differences and jitter. Probably mailboxes are the best way: a queue of transactions to be performed on the SD card, written on the fast side and read from the SD slow task.
Giovanni
You need to design so low priority task writing SD has enough time left from high priority tasks and ISRs. Decoupling the slow from the fast should do the trick and buffer speed differences and jitter. Probably mailboxes are the best way: a queue of transactions to be performed on the SD card, written on the fast side and read from the SD slow task.
Giovanni
Re: machine control + SDcard
May I recommend that doing the motor-stepping be done in an interrupt? A high priority task would then receive instructions from the scheduling/calculation tasks and put them on a small queue for the interrupt routines to be able to get the next instruction if the current instruction "runs dry".