-
Notifications
You must be signed in to change notification settings - Fork 14
Ambiq apollo3 serial fix #31
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
Conversation
// buffer_configure(pHandle, | ||
// psConfig->pui8TxBuffer, | ||
// psConfig->ui32TxBufferSize, | ||
// psConfig->pui8RxBuffer, | ||
// psConfig->ui32RxBufferSize); |
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.
was it necessary to change the HAL here? is it not enough to simply set these 4 buffers as NULL? (i figure the HAL would not do anything with them if they were not provided)
@@ -420,7 +420,7 @@ am_hal_uart_configure(void *pHandle, const am_hal_uart_config_t *psConfig) | |||
UARTn(ui32Module)->LCRH = (psConfig->ui32DataBits | | |||
psConfig->ui32Parity | | |||
psConfig->ui32StopBits | | |||
AM_HAL_UART_FIFO_ENABLE); | |||
AM_HAL_UART_FIFO_DISABLE); |
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.
does / should this HAL change go through our AmbiqSuiteSDK mirror branch?
is there really no way to change this setting via HAL calls w/ proper configuration?
// set default baud rate and format | ||
serial_baud(obj, 9600); | ||
serial_format(obj, 8, ParityNone, 1); | ||
if(!obj->serial.uart_control->handle) |
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.
i see you using the handle as an initialized
flag here... just commenting b/c i have recently doubted whether this method worked for the IOM modules
serial_format(obj, 8, ParityNone, 1); | ||
if(!obj->serial.uart_control->handle) | ||
{ | ||
//printf("setting up UART first time?\r\n"); |
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.
prolly don' need this printf... a comment or nothing would suffice
} | ||
|
||
void serial_free(serial_t *obj) | ||
{ | ||
//serialinitialized = false; |
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 variable is no longer used (opting for use of the handle as this flag) so we can remove
} | ||
|
||
NVIC_EnableIRQ((IRQn_Type)(UART0_IRQn + obj->serial.uart_control->inst)); | ||
|
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.
don't need (style nit)
// memset(obj->serial.uart_control->cfg, 0x00, sizeof(am_hal_uart_config_t)); // ensure config begins zeroed | ||
|
||
// config uart pins | ||
// config uart pins |
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.
can we get a line break above this? (style nit)
@Wenn0101 just requested some changes mostly b/c I had questions. The only actual changes would be style nits and possibly another way of configuring the HAL to do what we need. Otherwise looks real good |
removes unused comments, consistent brace style
missed one
this adds a new am_hal_uart_configure_fifo function which takes a boolean option whether to enable or disable FIFO operation
trying to match #31. it is too bad we have to do this manually...
Major changes:
-made certain parts of the init only happen on the first init
-comment out (is this the best option) part of ambiq hal that "sets up buffer" and disables interrupts if we arent using hal buffer
-change hal to use AM_HAL_UART_FIFO_DISABLE because i couldn't find a threshold that would allow the interrupt to fire on each byte otherwise
-serial_irq_set fixed to enable and disable individual interrupts
-remove fluff, TODO's, and temp code.
outstanding questions
-add FC or remove TODO's?