Uart on Jetson AGX avier

We have a problem using the serial port.
1.gps module sends one frame of data per second.But cgps refreshes the data per four seconds.
2.I modified TEGRA_UART_RX_DMA_BUFFER_SIZE from 4096 to 1024,and cgps refreshes the data per second.
3.I use cutecom to test, and the result is the same as cgps.
I am worried that modifying TEGRA_UART_RX_DMA_BUFFER_SIZE will cause other problems,
Please provide a solution so that cgps can synchronize gps data per second. Thank you.
serial-tegra.c:55:#define TEGRA_UART_RX_DMA_BUFFER_SIZE 1024//4096

Moving to Jetson AGX Xavier forum for resolution.

hello madayi21,

what’s your actual use-case,
you may have a try to decrease the sample rate of GPS module.
also, may I know what cgps it is; is it your code implementation to consume GPS data every four seconds?

Dear JerryChang,
We want to use gps+pps for timing,
Now we use gpsd+cgps to confirm gps data.
The baud rate of gps is 9600.
We have done the following experiments,

  1. AGX->USB Serial Converter->gps module, cgps refreshes the data per second.
    2.AGX ->ttyTHS0->gps cgps refreshes the data every four seconds.
    The refresh interval of cgps vary with TEGRA_UART_RX_DMA_BUFFER_SIZE
    From the experiment, there seems to be a problem with the serial port driver.


Can you try to disable RX DMA using this change in device tree and report back your finding? Make sure you update the right uart instance you are using.

serial@70006300 {
	compatible = "nvidia,tegra114-hsuart";
	dma-names = "tx";
	status = "okay";

Dear Bibek,
I have disabled DMA,and cgps refreshed correctly.
diff --git a/kernel-dts/tegra194-soc/tegra194-soc-uart.dtsi b/kernel-dts/tegra194-soc/tegra194-soc-uart.dtsi
index 04a4084…69cdbca 100644
— a/kernel-dts/tegra194-soc/tegra194-soc-uart.dtsi
+++ b/kernel-dts/tegra194-soc/tegra194-soc-uart.dtsi
@@ -33,8 +33,8 @@
reg-shift = <2>;
interrupts = <0 TEGRA194_IRQ_UARTA 0x04>;
nvidia,memory-clients = <14>;

  •           dmas = <&gpcdma 8>, <&gpcdma 8>;
  •           dma-names = "rx", "tx";
  •           /*dmas = <&gpcdma 8>, <&gpcdma 8>;
  •           dma-names = "rx", "tx";*/
              clocks = <&bpmp_clks TEGRA194_CLK_UARTA>,
                      <&bpmp_clks TEGRA194_CLK_PLLP_OUT0>;
              clock-names = "serial", "parent"

I used cgps for testing last night, and this morning I found that the machine has restarted automatically.
cgps: GPS timeout
root@cookoo:~# [ 8276.266489] serial-tegra 3100000.serial: RxData PIO to tty layer failed
[ 8292.171852] serial-tegra 3100000.serial: RxData PIO to tty layer failed
[ 8292.172694] bpmp: mrq 22 took 3996000 us
[ 8294.135978] serial-tegra 3100000.serial: RxData PIO to tty layer failed
[ 8294.136244] bpmp: mrq 22 took 1964000 us
[ 8294.136409] bpmp: mrq 27 took 1964000 us
[ 8308.628697] Kernel panic - not syncing: Watchdog detected hard LOCKUP on cpu 0
[ 8308.628920] CPU: 3 PID: 15543 Comm: kworker/u16:2 Not tainted 4.9.140-tegra #12
[ 8308.629062] Hardware name: Jetson-AGX (DT)
[ 8308.629177] Workqueue: events_unbound flush_to_ldisc
[ 8308.629287] Call trace:
[ 8308.629364] [] dump_backtrace+0x0/0x198
[ 8308.629474] [] show_stack+0x24/0x30
[ 8308.629577] [] dump_stack+0x98/0xc0
[ 8308.629686] [] panic+0x11c/0x298
[ 8308.629792] [] watchdog_check_hardlockup_other_cpu+0x11c/0x120
[ 8308.629935] [] watchdog_timer_fn+0x98/0x2c0
[ 8308.630046] [] __hrtimer_run_queues+0xd8/0x360
[ 8308.630163] [] hrtimer_interrupt+0xa8/0x1e0
[ 8308.630282] [] arch_timer_handler_phys+0x38/0x58
[ 8308.630721] [] handle_percpu_devid_irq+0x90/0x2b0
[ 8308.631219] [] generic_handle_irq+0x34/0x50
[ 8308.631625] [] __handle_domain_irq+0x68/0xc0
[ 8308.633401] [] gic_handle_irq+0x5c/0xb0
[ 8308.638828] [] el1_irq+0xe8/0x194
[ 8308.643388] [] mutex_lock+0x30/0x60
[ 8308.648713] [] flush_to_ldisc+0x48/0x118
[ 8308.654056] [] process_one_work+0x1e4/0x4b0
[ 8308.659398] [] worker_thread+0x50/0x4c8
[ 8308.665166] [] kthread+0xec/0xf0
[ 8308.670153] [] ret_from_fork+0x10/0x30
[ 8308.675417] SMP: stopping secondary CPUs
[ 8309.769210] SMP: failed to stop secondary CPUs 0-1,3
[ 8309.769356] Kernel Offset: disabled
[ 8309.769428] Memory Limit: none
[ 8309.769495] trusty-log panic notifier - trusty version Built: 21:16:17 Jun 25 2020 [ 8309.784113] Rebooting in 5 seconds…
[ 8314.796199] SMP: stopping secondary CPUs
[ 8315.177647] serial-tegra 3100000.serial: RxData PIO to tty layer failed
Shutdown state requested 1
Rebooting system [0000.055] W> RATCHET: MB1 binary ratchet value 4 is too large than ratchet level 2 from HW fuses.

please only disable rx dma and not both. You just need to remove rx from dma-names.
Also, from the log it looks like user thread is not consuming the data that is resulting in “serial-tegra 3100000.serial: RxData PIO to tty layer failed”. Can you check.

OK, I will try again in your way.
Can you give me some suggestions on using the serial port?
In what circumstances should DMA be enabled or disabled?
Will disabling DMA when transferring large amounts of data at high rates cause problems such as overrun?

Hi Bibek,
The kernel crash is related to the consumption of data by gpsd, but I did not how to let gpsd consume the data in time.Can you give me some help on this?Thank you.

you can try to increase the priority of the process, consuming the data.
renice -n -10 <process_ID>

Hi Bibek
The default priority of the gpsd process is 10.
There is no problem by using USB Serial Converter.
Can this problem be solved by optimizing the ttyTHS serial port driver?

Dear Bibek,
Do you have any new developments or suggestions for this issue?

Hi Madayi,

Can you try to set the process priority to -10 as suggested earlier.
Meanwhile I will check internally on the issue


1 Like

Hi Bibek,
I have tried to set the process priority to -10,and the issue of kernel panic still exists.

1 Like

Hi Bibek,
Is there any update?

1 Like