mdma driver error handling

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
alex31
Posts: 343
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 34 times
Been thanked: 51 times
Contact:

mdma driver error handling

Postby alex31 » Wed Jul 07, 2021 10:28 am

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: 343
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 34 times
Been thanked: 51 times
Contact:

Re: mdma driver error handling

Postby alex31 » Wed Jul 07, 2021 3:12 pm

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: 13639
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 893 times
Been thanked: 772 times
Contact:

Re: mdma driver error handling

Postby Giovanni » Wed Jul 07, 2021 5:34 pm

Moving this in bug reports.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 4 guests