mdma driver error handling Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
User avatar
alex31
Posts: 445
Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times

mdma driver error handling

Post by alex31 »

Hello,

I am writing a MDMA user level driver, using the existing low level code already written on ChibiOS.

I have a little problem withe the error handling : when the mdma detect an error, it writes CESR (Channel Error Status Register) with bits corresponding to different kind of error, set bit TEIF in CISR code, and trigger ISR. When error bit is cleared writing CTEIF in CIFCR register, that also clear the CESR register containing the error code.

for now the ISR is written like that :

Code: Select all

static void mdma_serve_interrupt(const stm32_mdma_channel_t *mdmachp) {
  uint32_t flags;

  flags = mdmachp->channel->CISR;
  mdmachp->channel->CIFCR = flags; // clear Error Status Register
  if (mdmachp->func != NULL) {
    mdmachp->func(mdmachp->param, flags);
  }
 
}


The problem is that the CESR register is cleared before call to handling code.

Is is possible to move the

Code: Select all

mdmachp->channel->CIFCR = flags; 
line at the end of the function, after the call to the handler ?

I have tested that it resolves my problem, but I don't know if the change is compatible with WSPI which is for now the only ChibiOS driver that use MDMA low level API.

Alexandre
User avatar
alex31
Posts: 445
Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times

Re: mdma driver error handling

Post by alex31 »

Another solution could be to pack all the useful bits from CISR (6 bits) and the useful bits of CESR (12 bits) in the 32 bits parameter flags.

A.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: mdma driver error handling

Post by Giovanni »

Moving this in bug reports.

Giovanni
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: mdma driver error handling

Post by Giovanni »

Hi,

I placed this change in trunk: CISR in lower 16 bits, CESR in upper 16 bits.

Let me know how it goes, I could backport this if needed.

Giovanni
User avatar
alex31
Posts: 445
Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times

Re: mdma driver error handling

Post by alex31 »

Hello,

It's Ok for me, and yes, I am interested by a 21.11 backport.

Alexandre
Post Reply