Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SITL: add UART tx/rx tracking and @SYS/uarts.txt #26672

Merged
merged 5 commits into from
Apr 3, 2024

Conversation

IamPete1
Copy link
Member

@IamPete1 IamPete1 commented Apr 2, 2024

Extract from #26532. This adds a byte tracking helper StatsTracker which allows the UART driver to keep a cumulative count rather than zeroing. ChibiOS is moved to use that and SITL gets by tracking and fills in @SYS/uarts.txt.

SITL:

UARTV1
SERIAL0 TX=   60956 RX=     354 TXBD= 36742 RXBD=   213 connected     (tcp:0:wait)
SERIAL1 TX=       0 RX=       0 TXBD=     0 RXBD=     0 not connected (tcp:2)
SERIAL2 TX=   19259 RX=     812 TXBD= 11608 RXBD=   489 connected     (tcp:3)
SERIAL3 TX=    1089 RX=   35358 TXBD=   656 RXBD= 21312 connected     (GPS1)
SERIAL4 TX=       0 RX=       0 TXBD=     0 RXBD=     0 connected     (GPS2)
SERIAL5 TX=       0 RX=       0 TXBD=     0 RXBD=     0 not connected (tcp:5)
SERIAL6 TX=       0 RX=       0 TXBD=     0 RXBD=     0 not connected (tcp:6)
SERIAL7 TX=       0 RX=       0 TXBD=     0 RXBD=     0 not connected (tcp:7)
SERIAL8 TX=       0 RX=       0 TXBD=     0 RXBD=     0 not connected (tcp:8)

ChibiOS (CubeOrange):

UARTV1
SERIAL0 OTG1  TX =    7809 RX =     620 TXBD=  8632 RXBD=   685
SERIAL1 UART2 TX =     214 RX*=       0 TXBD=   236 RXBD=     0
SERIAL2 UART3 TX =     214 RX*=       0 TXBD=   236 RXBD=     0
SERIAL3 UART4 TX =    1296 RX =       0 TXBD=  1432 RXBD=     0
SERIAL4 UART8 TX =       0 RX*=       0 TXBD=     0 RXBD=     0
SERIAL5 UART7 TX =     611 RX*=     234 TXBD=   675 RXBD=   258
SERIAL6 OTG2  TX =       0 RX =       0 TXBD=     0 RXBD=     0
IOMCU   UART6 TX*=   72638 RX*=   42920 TXBD= 80298 RXBD= 47446

The last commit updates the SITL bw_in_bytes_per_second function to report the true baudrate if baud rate limiting is enabled.

{
uint32_t now_ms = AP_HAL::millis();
const uint32_t tx_bytes = stats.tx.update(_tx_stats_bytes);
const uint32_t rx_bytes = stats.rx.update(_rx_stats_bytes);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea was raised (not for this PR) that it would be good to add logging for these roughly every 10s in flight.

@tridge
Copy link
Contributor

tridge commented Apr 3, 2024

@IamPete1 great work, thanks!

@IamPete1 IamPete1 merged commit d93cc7f into ArduPilot:master Apr 3, 2024
91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants