0
\$\begingroup\$

Board: TivaTM C Series TM4C1294

EK-TM4C1294XL

My program is listening to 2 UART ports (UART 3 and 7)

I've encounter a problem that I'm losing some bytes received and I'm suspecting that this issue relate to the UART's interrupts.

I understand that UARTs have nested interrupts but does both of them are serial?

For example: I'm inside UART 3 interrupt function and then while UART 3 didn't finish the interrupt (just copy their bytes to buffer) UART 7 interrupts arrives, does the system moves to UART 7 or it will first finish UART 3 and then moves to the UART 7?

Currently I'm suffering from error bytes something like 45-400 bytes for file that his size in 12 Mbytes.

I'm suspecting the above issue cause this issues.

p.s if only 1 UART is sending data I have binary same files on both host and PC.

Null
7,81618 gold badges38 silver badges49 bronze badges
asked Jul 22, 2015 at 13:48
\$\endgroup\$
5
  • \$\begingroup\$ You need to set priority, also 45-400 bytes on a 12 Mb isn't a disaster, you can calculate the ratio on byte loss per millions. With any comm protocol, you will loose some info. \$\endgroup\$ Commented Jul 22, 2015 at 14:48
  • \$\begingroup\$ What API are you using? \$\endgroup\$ Commented Jul 22, 2015 at 14:51
  • \$\begingroup\$ Also, What devices are sending data to the MCU? \$\endgroup\$ Commented Jul 22, 2015 at 14:53
  • \$\begingroup\$ You send data to your PC on 2 UART channel? \$\endgroup\$ Commented Jul 22, 2015 at 14:54
  • \$\begingroup\$ i am using usb to ttl to send the info to the rx of the micro chip uart pins... \$\endgroup\$ Commented Jul 22, 2015 at 17:21

3 Answers 3

1
\$\begingroup\$

Your problem will be solved if you give priority levels to your interrupts, so first won't bother second.

Here is one example:

NVIC_SetPriority(UART3_IRQn, 0);
NVIC_SetPriority(UART7_IRQn, 1);

While one interrupt is being serviced, second arrived is in pending state.

answered Jul 22, 2015 at 13:59
\$\endgroup\$
14
  • \$\begingroup\$ But in case I have few interrupts it will serve them as fifo? \$\endgroup\$ Commented Jul 22, 2015 at 14:02
  • \$\begingroup\$ Please be more clear. \$\endgroup\$ Commented Jul 22, 2015 at 14:04
  • \$\begingroup\$ For example uart 3 will have interrupt then 7 then 3 .does the priority won't starve com7? \$\endgroup\$ Commented Jul 22, 2015 at 14:12
  • \$\begingroup\$ And priority 1 is higher than 0? \$\endgroup\$ Commented Jul 22, 2015 at 14:13
  • \$\begingroup\$ Lower priority numbers represent higher priority level. \$\endgroup\$ Commented Jul 22, 2015 at 14:15
1
\$\begingroup\$

The solution I would implement is a uDMA. When the interrupt is raise, you let the uDMA handle the transfer therefore you can transfer data in the 2 uart at the same time tm4c129 can support up to 32 uDMA channels.

There is a uDMA example that is given by ti in tivaware. But with out any information about your device I cannot tell much more.

answered Jul 22, 2015 at 18:03
\$\endgroup\$
0
\$\begingroup\$

Each interrupt handler will run to completion before the other one gets any CPU cycles. If you change the interrupt priorities, that will no longer be true. In the case of Tiva UARTS, you'll want to adjust FIFO thresh-holds such that one UART can't overflow while you are servicing the other one. If both UART FIFOs fill up at the same time, you will drop some characters.

answered Oct 18, 2017 at 6:35
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.