Hi
I am facing an issue with the BLDC motor commutation speed when LINFlexD communication is in progress. When I send the measured speed information to PC terminal using LINFlexD in UART mode, I find that the motor commutation is affected. Thinking this is due to the interrupt priorities, I have set the Hall sensor capture interrupt priority to a high value.
INTC_0.PSR[611].R = 0x801D; //Set priority for external eTimer interrupt.
I am using the below example code for transmitting the values using LINFlexD
/*******************************************************************************
Function Name : TransmitData
Parameters : pBuf - input string. won't be modified by the function
: cnt - input number of characters to be transmitted
Notes : Tx data on LINFlexD_1. polled mode.
*******************************************************************************/
void TransmitData(const char *pBuf, uint32_t cnt)
{
uint8_t j = 0; // Dummy variable
for (j=0; j< cnt; j++)
{ // Loop for character string
LINFlexD_1.BDRL.B.DATA0 = *(pBuf+j);
//write character to transmit buffer
while (1 != LINFlexD_1.UARTSR.B.DTFTFF) {}
// Wait for data transmission completed flag
LINFlexD_1.UARTSR.R = 0x0002;
// clear the DTF flag and not the other flags
}
}
Can anyone help please?
Hi,
if the TransmitData() is not called within other interrupt then there should not be an issue. If yes, then check if nested interrupts are enabled. With interrupt nesting allowed the interrupt handler contains necessary prolog and epilog and interrupts are enabled again during prolog allowing interrupt with higher priority to be called immediately.
So check your IVOR4 handler.
BR, Petr
TransmitData() is called in a while loop at a scheduled interval (500msec), and not in a nested interrupt. That is why I was wondering how my commutation is affected.
I can only recommend to check priorities of all enabled interrupts and be sure nested interrupts are allowed.
A normal interruptible code, TransmitData() you have, cannot affect interrupt generation.
BR, Petr