Page 1 of 1

Documentation suggestions

Posted: Thu Apr 26, 2018 9:12 am
by mmccoo
I'm new to ChibiOS and fairly new to embedded. There are some things I struggled with in my learning curve that largely come down to documentation.

My recommendations:

for palSetPadMode and palSetGroupMode

[in] mode pad mode

not helpful as it is. What's a mode? It'd be clearer list off the modes:
PAL_MODE_INPUT_ANALOG
PAL_MODE_OUTPUT_PUSHPULL
...

even if the complete list is not maintainable, a pointer to hal_pal.h would be a start


mitmatch in PWMConfig desc
on this page http://chibios.sourceforge.net/html/str ... onfig.html, the description of PWMConfig doesn't match. I didn't find an STM32 variant on doc page. Perhaps in the opening note, a hint to look in x,y, or z directories.


Usage of DMA
In the docs, I don't see any recommendations on how to use DMA. In my example, I want DMA to feed PWM. The PWM driver relies on interrupts. Your HAL probably can't handle all DMA situations, so guidance could help. Perhaps attached to this page: http://chibios.sourceforge.net/docs/hal ... d_m_a.html

There are a bunch of things that need to be done to do this particular example. Perhaps you can comment if I did something wrong:
bool b;
b = dmaStreamAllocate(STM32_DMA1_STREAM2,
STM32_ADC_ADC1_IRQ_PRIORITY,
(stm32_dmaisr_t)my_serve_interrupt,
(void *)0x0);
osalDbgAssert(!b, "stream already allocated");
dmaStreamSetPeripheral(STM32_DMA1_STREAM2, &TIM1->CCR1);
dmaStreamSetMemory0(STM32_DMA1_STREAM2, SIN_DATA);
dmaStreamSetTransactionSize(STM32_DMA1_STREAM2, (uint32_t)sizeof(SIN_DATA)/sizeof(uint16_t));
dmaStreamSetMode(STM32_DMA1_STREAM2, STM32_DMA_CR_DIR_M2P|STM32_DMA_CR_HTIE|STM32_DMA_CR_TEIE|STM32_DMA_CR_CIRC|STM32_DMA_CR_TCIE|STM32_DMA_CR_PSIZE_HWORD|STM32_DMA_CR_MSIZE_HWORD|STM32_DMA_CR_MINC);
dmaStreamEnable(STM32_DMA1_STREAM2);



Broken link
This page: http://www.chibios.org/dokuwiki/doku.ph ... cles:start has a broken link: I am new with chibios


need more content
The playembedded articles are all tagged as deprecated. Perhaps additional comments on how relevant the article is. (note my other message about PWM now starting due to SWSTART flag)

The doc page could use more how to. How to use DMA, for example. DMA to feed PWM (if you want to get fancy, how to keep a cyclical buffer full. I don't want to do it in Half/Full interrupt, but those interrupts should wake a thread). TIM1 to trigger ADC.



Hope it helps. And please advise if I've done something stupid in PWM DMA above.

Miles

Re: Documentation suggestions

Posted: Fri Apr 27, 2018 2:09 pm
by alex31
Hello,

For the DMA point, i have written a driver is the spirit of chibios, which verifies as possible consistency of parameters in use,
see the announcement : http://www.chibios.com/forum/viewtopic.php?f=8&t=4596

I currently use this driver to generate DSHOT frames, connecting a DMA channel to a timer.

Alexandre

Re: Documentation suggestions

Posted: Sun Nov 10, 2019 10:31 am
by Giovanni
bump