# Subscribing to UART events causes program restart

**URL:** <https://forum.sierrawireless.com/t/subscribing-to-uart-events-causes-program-restart/3074>\
**Category:** General\
**Created:** [March 26, 2009, 6:19am UTC](https://forum.sierrawireless.com/t/subscribing-to-uart-events-causes-program-restart/3074 "2009-03-26T06:19:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![noim](https://avatars.discourse-cdn.com/v4/letter/n/67e7ee/32.png) [@noim](https://forum.sierrawireless.com/u/noim)\
**Post date:** [March 26, 2009, 6:19am UTC](https://forum.sierrawireless.com/t/subscribing-to-uart-events-causes-program-restart/3074/1 "2009-03-26T06:19:11Z")

</div>

Hi.

I have some issues with unexpected OAT application restart. I use UART Device Service to open UART2 port and get access to UART port events. In order to do that I fill sUartEvent\_t structure and pass a pointer to it in event\_handlers field of sUartSettings\_t structure. To begin with I set handler to TX\_COMPLETE event.  
When the port is opened I send there some data and expect my handler to be called, but I get application restart instead.  
Here is part of the code where sUartEvent\_t structure is filled.

```auto
memset(&uart_events, 0, sizeof(uart_events));

    uart_events.op = G_IOC_OP_SET;
    uart_events.valid_cb = (eUartEvId_t)(UART_CB_ON_TX_COMPLETE);
    uart_events.user_data = (void*)-1L;
    uart_events.cb_list[0].evt_hdl = (pGEvtNotif_t)OnTXC;
    uart_events.cb_list[0].user_data = NULL;
```

OnTXC is empty handler and is defined like this:

```auto
void OnTXC(void* p1, void* p2){ }
```

Program restart occurs when all data is transmitted through UART port. If I connect to the other side with terminal I can see incoming data.  
If a NULL pointer is passed to “event\_handlers” field of “sUartSettings\_t” structyre program runs fine.

CPU: 2686H, FW: R73\_00gg.Q2686H
