Skip to content

arch/tricore: Drive the ASCLIN UART without the iLLD (6/n)) - #21545

Merged
acassis merged 5 commits into
apache:masterfrom
linumiz:native-2.5-uart
Nov 20, 2026
Merged

acassis merged 5 commits into
apache:masterfrom
linumiz:native-2.5-uart

Conversation

@ssekar15

@ssekar15 ssekar15 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The TC3xx and TC4xx serial drivers are the same code apart from the chip,
and set up the ASCLIN and the UART pins through the iLLD IfxAsclin and
IfxPort drivers. This PR replaces both with one native ASCLIN driver in a
new src/common/aurix directory for the peripheral drivers that both AURIX
families share, which the tc3xx and tc4xx build files pull in, and stops
building the iLLD ASCLIN and port drivers.

Dependency

Depends on #21546 (startup), which now comes before it.

Impact

TriCore only. tc3xx_serial.c and tc4xx_serial.c are replaced by
src/common/aurix/tricore_serial.c; the UART Kconfig options are unchanged,
and the ASCLIN and pin registers after boot are the same as before.

Testing

I confirm that changes are verified on local setup and works as intended:

  • Build Host(s): Linux x86_64, Debian GNU/Linux 12 (bookworm)
  • Toolchains: AURIX GCC 11.3.1 (tricore-elf-gcc), TASKING VX-toolset v6.4r1
    (TC3x), TASKING SmartCode v10.4r1 (TC4x)
  • Build systems: make, cmake (Ninja)
  • Target(s): a2g-tc397-5v-tft:nsh, triboard_tc4x9_com:nsh
  • Hardware: TriBoard TC397 V2.0; TriBoard TC4x7 COM V3.0 for the
    triboard_tc4x9_com image
  • Each commit passes tools/checkpatch.sh.

Build results (tip):

Board GCC make GCC cmake TASKING make TASKING cmake
a2g-tc397-5v-tft:nsh pass pass pass pass
triboard_tc4x9_com:nsh pass pass pass pass

Runtime, ostest with GCC:

Board GCC
TriBoard TC397 (a2g-tc397-5v-tft:nsh) pass
TriBoard TC4x7 (triboard_tc4x9_com:nsh) pass
nsh> uname -a
NuttX 10.4.0 1c2c734b35f-dirty Nov 18 2026 20:02:37 tricore triboard_tc4x9_com
nsh> ostest
...
ostest_main: Exiting with status 0

@github-actions github-actions Bot added Arch: tricore Issues related to the TriCore architecture from Infineon Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Board: tricore labels Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

Comment thread arch/tricore/src/aurix/tricore_asclin.h Resolved
Comment thread arch/tricore/src/aurix/tricore_serial.c Resolved
@ssekar15 ssekar15 changed the title arch/tricore: Drive the ASCLIN UART without the iLLD (5/n)) arch/tricore: Drive the ASCLIN UART without the iLLD (6/n)) Nov 10, 2026
@github-actions github-actions Bot added the Area: OS Components OS Components issues label Nov 10, 2026
@ssekar15

Copy link
Copy Markdown
Contributor Author

@xiaoxiang781216 please help to add reviewers @acassis @GUIDINGLI @xiaoxiang781216 @casaroli

Comment thread arch/tricore/src/aurix/tricore_serial.c Resolved
Comment thread arch/tricore/src/aurix/CMakeLists.txt Resolved
@ssekar15

Copy link
Copy Markdown
Contributor Author

@zhangyu-duck please review

@github-actions github-actions Bot removed the Area: OS Components OS Components issues label Nov 17, 2026
Comment thread arch/tricore/src/CMakeLists.txt Resolved
@ssekar15

Copy link
Copy Markdown
Contributor Author

adding @GUIDINGLI

The UART driver reaches the ASCLIN and its pins only through the iLLD
IfxAsclin and IfxPort.  Add the ASCLIN0 base and register offsets of
TC3xx and TC4xx, which differ, to hardware/tc3xx_asclin.h and
hardware/tc4xx_asclin.h, and the register bits, which are the same, to a
new src/common/aurix/tricore_asclin.h, for the AURIX drivers common to
both families, as checked against the TC39xB and TC4Dx iLLD headers.
Add the port registers and pin modes of the UART pins to
hardware/tc3xx_port.h and hardware/tc4xx_port.h.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
The baud rate depends on the fast ASCLIN clock, which the iLLD UART
driver reads with IfxScuCcu_getAsclinFFrequency or
IfxClock_getAsclinFFrequency.  Add tricore_clock_asclinf, which computes
it the same way from the peripheral PLL and the ASCLINF divider.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
The TC3xx and TC4xx serial drivers are the same code but for the chip,
and set up the ASCLIN and the UART pins through IfxAsclin and IfxPort,
with the pins named by the iLLD pin map.  Replace both with one driver,
src/common/aurix/tricore_serial.c, which programs the ASCLIN registers
directly: 8N1, 16 times oversampling with three samples, FIFO interrupts
at one byte.  The fractional baud rate divider is the continued fraction
of the wanted ratio that fits the 12-bit BRG fields, in place of the
IfxAsclin search.  The P14.1 RX and P14.0 TX pins are set up with the
port registers, which are IOCR and PDR on TC3xx, under the CPU ENDINIT,
and PADCFG on TC4xx.

src/common/aurix holds the peripheral drivers that both families share;
the Make.defs and CMakeLists.txt of tc3xx and tc4xx pull it in, as the
stm32 chips do with common/stm32.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
Nothing uses IfxAsclin and the ASCLIN pin map any more, since the UART
driver programs the ASCLIN and its pins itself, so drop them from the
TC3xx and TC4xx builds.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
The UART pins were the last users of IfxPort, so drop IfxPort.c and its
pin configuration from the TC3xx and TC4xx builds.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
@github-actions github-actions Bot added Size: L The size of the change in this PR is large and removed Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Board: tricore labels Nov 19, 2026
@ssekar15

Copy link
Copy Markdown
Contributor Author

@zhangyu981027 please allow to merge if no further review comments

@ssekar15

Copy link
Copy Markdown
Contributor Author

@xiaoxiang781216 please add @acassis @raiden00pl to reviewer. Guide me how do I get these permission on NuttX to do myself.

@ssekar15

Copy link
Copy Markdown
Contributor Author

@zhangyu981027 ping unblock this PR to merge

@acassis
acassis merged commit 3127dd4 into apache:master Nov 20, 2026
26 checks passed
@ssekar15

Copy link
Copy Markdown
Contributor Author

@acassis many thanks

@cederom

cederom commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Great work @ssekar15 thank you for native implementation!! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: tricore Issues related to the TriCore architecture from Infineon Size: L The size of the change in this PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants