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;
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