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

Evan/uart #214

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Evan/uart #214

wants to merge 8 commits into from

Conversation

evanchen11
Copy link
Contributor

No description provided.

#endif

// UART0 interrupt handler.
am_hal_uart_config_t g_sUartConfig =
Copy link
Contributor

Choose a reason for hiding this comment

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

All of this should be 'hidden' behind the ns_uart API (generally, ns examples should have minimal ambiqsuite code).

import time

# Configure the serial port
SERIAL_PORT = '/dev/tty.usbmodem0011600012981' # apollo4l serial port
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a way to find the port automatically by looking for a uuid - see https://github.com/AmbiqAI/ns-mirror/blob/4c18e561603651d922afdaa26dedb8fbddccd78d/tools/ns_utils.py#L195 for how I did it for autodeploy

uint32_t init_uart(am_hal_uart_config_t *uart_config)
{
// Set the clock frequency.
am_hal_clkgen_control(AM_HAL_CLKGEN_CONTROL_SYSCLK_MAX, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

This through line 25 doesn't belong here (ns_peripheral_power controls power, and this uart code will override that.)

if (ui32BytesWritten != size)
{
// Couldn't send the whole string!!
while(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will hang if there any uart errors, which is not good. You should retry the send a number of times, and if it still doesn't move, eventually fail and return an error code.

@@ -0,0 +1,59 @@
import serial
Copy link
Contributor

Choose a reason for hiding this comment

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

You need stress tests too - hit the uart as hard as you can in each direction (random transfer sizes, long blocks, lots an lots of blocks, lots of tiny blocks, mix tx and rx). The fact that send_data doesn't have error handling tells me you need to try harder to cause errors. I guarantee you erpc will, and it'll be easier to debug a test than rpc.

Copy link
Contributor

Choose a reason for hiding this comment

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

same comments as ap3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants