CRC Driver with DMA problem

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

CRC Driver with DMA problem

Post by vrollei »

Hi,

there is a problem with CRC Driver (community) with CRC_USE_DMA=TRUE,
driver does not work correctly with buffer more 300k.
ChibiOS version - 17.6.3
steved
Posts: 834
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 138 times

Re: CRC Driver with DMA problem

Post by steved »

The DMA controller supports up to 64K items - i.e. 256K bytes if transferring 32-bit words. Could this be the limit?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: CRC Driver with DMA problem

Post by Giovanni »

If this is the problem then the driver needs to split transfers in chunks.

Giovanni
vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: CRC Driver with DMA problem

Post by vrollei »

Steved, you are right.

Giovani, yep, this is a problem, I check the firmware CRC and it could be up to 1M.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: CRC Driver with DMA problem

Post by Giovanni »

Hi,

There are other issues in that driver, for example crcCalcI() should be crcCalcS() because it calls an S-class inside (in the LLD). It also needs a SW fallback mode so other drivers can use it, right now we have several CRC SW implementation in various places, this is not good.

I will look into importing in in the main repository and make adjustments.

Giovanni
vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: CRC Driver with DMA problem

Post by vrollei »

There are some mistakes with defines as well, I will post changes here later.
vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: CRC Driver with DMA problem

Post by vrollei »

Sorry, there is no any define mistakes in CRC module, I mixed up it with QEI driver:

community/os/hal/include/hal_qei.h

Code: Select all

 */
 typedef enum {
   QEI_OVERFLOW_WRAP    = 0,     /**< Counter value will wrap around.        */
-#if QEI_USE_OVERFLOW_DISCARD == TRUE
+#if defined(QEI_USE_OVERFLOW_DISCARD) && QEI_USE_OVERFLOW_DISCARD == TRUE
   QEI_OVERFLOW_DISCARD = 1,     /**< Counter doesn't change.                */
 #endif
-#if QEI_USE_OVERFLOW_MINMAX == TRUE
+#if defined(QEI_USE_OVERFLOW_MINMAX) && QEI_USE_OVERFLOW_MINMAX == TRUE
   QEI_OVERFLOW_MINMAX  = 2,     /**< Counter will be updated upto min or max.*/
 #endif
 } qeioverflow_t;
mobyfab
Posts: 484
Joined: Sat Nov 19, 2011 6:47 pm
Has thanked: 21 times
Been thanked: 31 times

Re: CRC Driver with DMA problem

Post by mobyfab »

hi,

Please open a ticket here: https://github.com/ChibiOS/ChibiOS-Contrib/issues
We'll have a look at the driver.

Thanks!
vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: CRC Driver with DMA problem

Post by vrollei »

Hi mobyfab,

done

#161 and #162
Post Reply