-
Notifications
You must be signed in to change notification settings - Fork 7
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
base: main
Are you sure you want to change the base?
Evan/uart #214
Conversation
#endif | ||
|
||
// UART0 interrupt handler. | ||
am_hal_uart_config_t g_sUartConfig = |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comments as ap3
No description provided.