- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As a follow on to this closed thread: UART to RS485
What is the difference between P_UART_ISR_TX_FF_MASK and P_UART_ISR_TX_FAE_MASK ?
Do you have some example about UART callback transmission ?
Solved! Go to Solution.
- Labels:
-
Peripherhal UART
-
Watchdog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
just a suggestion , Can you add the TX enable in puart_control_tx_callback to avoid watch dog occurring ?
not to add them in the init function.
puart_enableTx();
puart_disableTx();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since I use a callback tx uart I have a watchdog reset problem:
My board periodicly receive uart data and send data tx response.
This is my uart Init:
static void tw_puart_init(UINT8 rxPortPin, UINT8 txPortPin, UINT32 bdRate)
{
extern puart_UartConfig puart_config;
puart_config.baudrate = bdRate; // Set the baud rate we want to use.
puart_selectUartPads(rxPortPin, txPortPin, 0x00, 0x00);
puart_init();
puart_flowOff();
devlpm_init();
devlpm_registerForLowPowerQueries(uart_device_lpm_queriable, 0);
P_UART_INT_CLEAR(P_UART_ISR_RX_AFF_MASK);
P_UART_WATER_MARK_RX_LEVEL(1);
P_UART_INT_ENABLE |= P_UART_ISR_RX_AFF_MASK;
P_UART_WATER_MARK_TX_LEVEL(1);
P_UART_INT_ENABLE |= P_UART_ISR_TX_FAE_MASK;//P_UART_ISR_TX_FF_MASK;
puart_txCb = puart_control_tx_callback;
//puart_enableTx(); // With and Without, I have the same problems
puart_rxCb = puart_control_rx_callback;
puart_enableInterrupt();
}
and In my tx callback:
static void puart_control_tx_callback(void)//* unused)
{
P_UART_INT_CLEAR(P_UART_ISR_TX_FAE_MASK);
data2send--;
if(data2send <= 0)
{
gpio_setPinOutput(GPIO_DE_RS485 / 16, GPIO_DE_RS485 % 16, CS_DEASSERT);
gpio_setPinOutput(GPIO_RE_RS485 / 16, GPIO_RE_RS485 % 16, CS_DEASSERT);
data2send = 0;
}
P_UART_INT_ENABLE |= P_UART_ISR_TX_FAE_MASK;
}
In my application I send datas with puart_write() and I increment the data2send flag. When data2send is null, All datas is sent and i reverse my rs485 in reception mode.
This works fine when I send data. But when I don't send data, the watchdog reset each 4-5sec. I have try with watchdog disabled and the problem disappears. Why my watchdog reset when I do nothing with the UART?
When I comment this
P_UART_WATER_MARK_TX_LEVEL(1);
P_UART_INT_ENABLE |= P_UART_ISR_TX_FAE_MASK;//P_UART_ISR_TX_FF_MASK;
puart_txCb = puart_control_tx_callback;
//puart_enableTx(); // With and Without, I have the same problems
I can't transmit data but the reset problem is solved...
Do you have any explanation?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
More specificly, in my tx callback function, I move the wdog_configure() function before and after the gpio_setPinOutput() function and It's works fine.
static void puart_control_tx_callback(void)//* unused)
{
P_UART_INT_CLEAR(P_UART_ISR_TX_FAE_MASK);
P_UART_INT_ENABLE |= P_UART_ISR_TX_FAE_MASK;
data2send--;
if(data2send <= 0)
{
wdog_configure(FALSE);
gpio_setPinOutput(GPIO_DE_RS485 / 16, GPIO_DE_RS485 % 16, CS_DEASSERT);
gpio_setPinOutput(GPIO_RE_RS485 / 16, GPIO_RE_RS485 % 16, CS_DEASSERT);
data2send = 0;
wdog_configure(TRUE);
}
}
I don't understand why the setPinOutput function is the cause of my watchdog problem... any idea?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nobody can help me about my watchdog problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will ask the apps team to take a look.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A last UP before I surrender
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
just a suggestion , Can you add the TX enable in puart_control_tx_callback to avoid watch dog occurring ?
not to add them in the init function.
puart_enableTx();
puart_disableTx();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot
The solution is to add puart_enableTx() in the callback function and not in the init.