In Ethercat demo (SDK 1.0.0.6) some ESC service routines are executed with interrupts disabled:
DISABLE_ESC_INT();
** esc_stuff_routine();
ENBLE_ESC_INT();
This screws up interrupts priorities.
For example, in an EtherCat application a periodic HWI should be higher priority than the others, but with DISABLE_ESC_INT() this is impossible.
As workaround I've changed those defines that way:
//#define DISABLE_ESC_INT() bsp_global_mutex_lock();
//#define ENABLE_ESC_INT() bsp_global_mutex_unlock();
#define DISABLE_ESC_INT() ( ( *((volatile unsigned int *)(0x48200084)))|=0x00300000 )
#define ENABLE_ESC_INT() ( ( *((volatile unsigned int *)(0x48200084)))&=~0x00300000 )
Only PRUSS interrupts are disabled. I can't understand all that "bsp_global_mutex_lock" and "bsp_global_mutex_unlock" stuff: I'm not a software engineer, so I just write a couple of bits in a config register!
Can this method cause problems?
Why all interrupts are disabled before servicing EtherCat data?
Why EtherCat service routines must be atomic?