-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
Hi,
After generating code with the MCC for the UARTS configured as non-blocking mode I could not find the section of the code in which the rx and fault interrupts were enabled ( I was looking for IEC3SET = _IEC3_U1EIE_MASK; and IEC3SET = _IEC3_U1RXIE_MASK;). After digging for some time I decided to change the operation mode to ring buffer, because it should also generate the interrupts, and in this case in this enable them, in the end of the UART_Initialization() function. I tried multiple times to upload
MCU used: pic32MZ2064DAH176
Generated code
Non Blocking
void UART2_Initialize( void )
{
/* Set up UxMODE bits */
/* STSEL = 0*/
/* PDSEL = 0 */
/* BRGH = 0 */
/* RXINV = 0 */
/* ABAUD = 0 */
/* LPBACK = 0 */
/* WAKE = 0 */
/* SIDL = 0 */
/* RUNOVF = 0 */
/* CLKSEL = 3 */
/* SLPEN = 0 */
/* UEN = 0 */
U2MODE = 0x60000;
/* Enable UART2 Receiver, Transmitter and TX Interrupt selection */
U2STASET = (_U2STA_UTXEN_MASK | _U2STA_URXEN_MASK | _U2STA_UTXISEL1_MASK );
/* BAUD Rate register Setup */
U2BRG = 53;
/* Disable Interrupts */
IEC4CLR = _IEC4_U2EIE_MASK;
IEC4CLR = _IEC4_U2RXIE_MASK;
IEC4CLR = _IEC4_U2TXIE_MASK;
/* Initialize instance object */
uart2Obj.rxBuffer = NULL;
uart2Obj.rxSize = 0;
uart2Obj.rxProcessedSize = 0;
uart2Obj.rxBusyStatus = false;
uart2Obj.rxCallback = NULL;
uart2Obj.txBuffer = NULL;
uart2Obj.txSize = 0;
uart2Obj.txProcessedSize = 0;
uart2Obj.txBusyStatus = false;
uart2Obj.txCallback = NULL;
uart2Obj.errors = UART_ERROR_NONE;
/* Turn ON UART2 */
U2MODESET = _U2MODE_ON_MASK;
}Ring Buffer
void UART1_Initialize( void )
{
/* Set up UxMODE bits */
/* STSEL = 0*/
/* PDSEL = 0 */
/* BRGH = 0 */
/* RXINV = 0 */
/* ABAUD = 0 */
/* LPBACK = 0 */
/* WAKE = 0 */
/* SIDL = 0 */
/* RUNOVF = 0 */
/* CLKSEL = 3 */
/* SLPEN = 0 */
U1MODE = 0x60000;
/* Enable UART1 Receiver, Transmitter and TX Interrupt selection */
U1STASET = (_U1STA_UTXEN_MASK | _U1STA_URXEN_MASK | _U1STA_UTXISEL1_MASK );
/* BAUD Rate register Setup */
U1BRG = 53;
IEC3CLR = _IEC3_U1TXIE_MASK;
/* Initialize instance object */
uart1Obj.rdCallback = NULL;
uart1Obj.rdInIndex = 0;
uart1Obj.rdOutIndex = 0;
uart1Obj.isRdNotificationEnabled = false;
uart1Obj.isRdNotifyPersistently = false;
uart1Obj.rdThreshold = 0;
uart1Obj.wrCallback = NULL;
uart1Obj.wrInIndex = 0;
uart1Obj.wrOutIndex = 0;
uart1Obj.isWrNotificationEnabled = false;
uart1Obj.isWrNotifyPersistently = false;
uart1Obj.wrThreshold = 0;
uart1Obj.errors = UART_ERROR_NONE;
if (UART1_IS_9BIT_MODE_ENABLED())
{
uart1Obj.rdBufferSize = UART1_READ_BUFFER_SIZE_9BIT;
uart1Obj.wrBufferSize = UART1_WRITE_BUFFER_SIZE_9BIT;
}
else
{
uart1Obj.rdBufferSize = UART1_READ_BUFFER_SIZE;
uart1Obj.wrBufferSize = UART1_WRITE_BUFFER_SIZE;
}
/* Turn ON UART1 */
U1MODESET = _U1MODE_ON_MASK;
/* Enable UART1_FAULT Interrupt */
IEC3SET = _IEC3_U1EIE_MASK;
/* Enable UART1_RX Interrupt */
IEC3SET = _IEC3_U1RXIE_MASK;
}Metadata
Metadata
Assignees
Labels
No labels