mdma driver error handling Topic is solved

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

mdma driver error handling  Topic is solved

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: 374
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 38 times
Been thanked: 61 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: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: mdma driver error handling

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

Moving this in bug reports.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: mdma driver error handling

Postby Giovanni » Fri Mar 18, 2022 1:29 pm

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

Re: mdma driver error handling

Postby alex31 » Sun Mar 20, 2022 3:15 pm

Hello,

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

Alexandre


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 21 guests