cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
taddabenatia
Visitor
Visitor
417 Views
Registered: ‎03-21-2019

AXI intc handler troubles

I try again, I have been reported as a spam but I don't know where to get help for this except for this forum. Sorry in advance for the moderators

To introduce my problem I have a design in wich I want to use the UART IP connected to an AXI interrupt IP. I use the PS for the processing part. I can't make the interrupt example work, after thorough investigation I noticed the processing part never raise any interrupt when we receive or send data (the handler is never called)

Here is the example I'm talking about :

__________________________________________________

int UartNs550IntrExample(INTC *IntcInstancePtr, XUartNs550 *UartInstancePtr, u16 UartDeviceId, u16 UartIntrId)
{
  int Status;
  u32 Index;
  u16 Options;
  u32 BadByteCount = 0;


  /*
  * Initialize the UART driver so that it's ready to use.
  */
  Status = XUartNs550_Initialize(UartInstancePtr, UartDeviceId);
  if (Status != XST_SUCCESS) {
    return XST_FAILURE;
  }

  /*
  * Perform a self-test to ensure that the hardware was built correctly.
  */
  Status = XUartNs550_SelfTest(UartInstancePtr);
  if (Status != XST_SUCCESS) {
    return XST_FAILURE;
  }

  /*
  * Connect the UART to the interrupt subsystem such that interrupts can
  * occur. This function is application specific.
  */
  Status = UartNs550SetupIntrSystem(IntcInstancePtr, UartInstancePtr, UartIntrId);
  if (Status != XST_SUCCESS) {
    return XST_FAILURE;
  }

  /*
  * Setup the handlers for the UART that will be called from the
  * interrupt context when data has been sent and received, specify a
  * pointer to the UART driver instance as the callback reference so
  * the handlers are able to access the instance data.
  */
  XUartNs550_SetHandler(UartInstancePtr, UartNs550IntrHandler, UartInstancePtr);

  /*
  * Enable the interrupt of the UART so interrupts will occur, setup
  * a local loopback so data that is sent will be received, and keep the
  * FIFOs enabled.
  */
  Options = XUN_OPTION_DATA_INTR | XUN_OPTION_LOOPBACK |
  XUN_OPTION_FIFOS_ENABLE;
  XUartNs550_SetOptions(UartInstancePtr, Options);


  /*
  * Initialize the send buffer bytes with a pattern to send and the
  * the receive buffer bytes to zero to allow the receive data to be
  * verified.
  */
  for (Index = 0; Index < TEST_BUFFER_SIZE; Index++) {
    SendBuffer[Index] = Index + 'A';
    RecvBuffer[Index] = 0;
  }

  /*
  * Start receiving data before sending it since there is a loopback,
  * ignoring the number of bytes received as the return value since we
  * know it will be zero and we are using interrupt mode.
  */
  XUartNs550_Recv(UartInstancePtr, RecvBuffer, TEST_BUFFER_SIZE);

  /*
  * Send the buffer using the UART and ignore the number of bytes sent
  * as the return value since we are using it in interrupt mode.
  */
  XUartNs550_Send(UartInstancePtr, SendBuffer, TEST_BUFFER_SIZE);

  /*
  * Wait for the entire buffer to be received, letting the interrupt
  * processing work in the background, this function may get locked
  * up in this loop if the interrupts are not working correctly.
  */
  while ((TotalReceivedCount != TEST_BUFFER_SIZE) ||
  (TotalSentCount != TEST_BUFFER_SIZE)) {
  }

...

__________________________________________________


I get stuck on this loop because of this handler :

__________________________________________________

void UartNs550IntrHandler(void *CallBackRef, u32 Event, unsigned int EventData)
{
  u8 Errors;
  XUartNs550 *UartNs550Ptr = (XUartNs550 *)CallBackRef;

  /*
  * All of the data has been sent.
  */
  if (Event == XUN_EVENT_SENT_DATA) {
    TotalSentCount = EventData;
  }

  /*
  * All of the data has been received.
  */
  if (Event == XUN_EVENT_RECV_DATA) {
    TotalReceivedCount = EventData;
  }

  /*
  * Data was received, but not the expected number of bytes, a
  * timeout just indicates the data stopped for 4 character times.
  */
  if (Event == XUN_EVENT_RECV_TIMEOUT) {
    TotalReceivedCount = EventData;
  }

  /*
  * Data was received with an error, keep the data but determine
  * what kind of errors occurred.
  */
  if (Event == XUN_EVENT_RECV_ERROR) {
    TotalReceivedCount = EventData;
    TotalErrorCount++;
    Errors = XUartNs550_GetLastErrors(UartNs550Ptr);
  }

}

...

__________________________________________________


All the other tests (using the same recv and send function) work, only when it comes to the interruption it gets stuck on this loop because of the handler

0 Kudos
0 Replies