I have a function that is called by the Systick Interrupt to load characters from my Transmit Buffer in Software into the part's Uart4 TX buffer. It is intended to add up to 10 characters per interrupt, if they are available and there is room in the part''s TX buffer. The function is shown below:
/*******************************************************************************
Function: Uart4_Load_TX_Buffer
Description: This function is called by the SysTick Interrupt routine and
loads up to 10 characters from the Uart4 circular buffer into
the Part's TX Buffer. The routine returns when either the
part TX Buffer is full, ten characters have been loaded or
there are no more characters available to be sent.
Parameters: None
Returns: Nothing
*******************************************************************************/
void Uart4_Load_TX_Buffer(void)
{
int index = 0;
// Disable Interrupts
ROM_IntMasterDisable();
// check to see if all conditions met
while ( index < 10 &&
Com4_TX_Head != Com4_TX_Tail &&
//ROM_UARTSpaceAvail(UART4_BASE)
UARTSpaceAvail(UART4_BASE)
)
{
// increment the index
++index;
// send the next character to the part TX Buffer
// ROM_UARTCharPutNonBlocking(UART4_BASE, Com4_TX_Buffer[Com4_TX_Tail]);
// Increment the buffer tail
++Com4_TX_Tail;
// Check for wraparound
if (Com4_TX_Tail >= Com4TXBufferSize)
{
// reset to beginning of buffer
Com4_TX_Tail = 0;
}
}
// Enable Interrupts
ROM_IntMasterEnable();
}
1. If I take out the Space available test and the CHarPut the function runs without failure,
2. If I add any of the Space Available and Char Puts I get Fault ISr's, and I am not sure why.
3. Are there any restrictions to using those functions within interrupts?
4. Is there a special order in which to initialize the UART that would allow the functions to work?
5. Since I am using the Systick interrupt to load the TX buffer is there a recommended UART setup for the UART? I am assuming I don't need to use the TX interrupt since I am filling the buffer based on availability of character space.65. Is there an example that actually uses these functions within interrupts where I can see what needs to be set up in the interrupt and the UART to make these functions run? I have problems when the documentation is written to the most trivial form and leaves out actual examples to show how the functions actually work.