Skip to content

Commit 61796a4

Browse files
authored
Set aducm355 baudrate to 115200 and busy_wait (#279)
* Use baud rate of 115200, do some waiting between each call to get_physical_time, and print message at startup * Format
1 parent 0f5febe commit 61796a4

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/environments/unfederated_environment.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ static void Environment_assemble(Environment *self) {
2121

2222
static void Environment_start(Environment *self) {
2323
instant_t start_time = self->get_physical_time(self);
24+
LF_INFO(ENV, "Starting program at " PRINTF_TIME " nsec", start_time);
2425
self->scheduler->set_and_schedule_start_tag(self->scheduler, start_time);
2526
self->scheduler->run(self->scheduler);
2627
}

src/platform/aducm355/aducm355.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ void ClockInit(void) {
5050
/** Initialize the UART system with a baud rate of 57600. This function was copied from vendor examples. */
5151
void UartInit(void) {
5252
// DioCfg(pADI_GPIO0,0x500000); // Setup P0[11:10] as UART pins
53-
DioCfgPin(pADI_GPIO0, PIN10, 1); // Setup P0.10 as UART pin
54-
DioCfgPin(pADI_GPIO0, PIN11, 1); // Setup P0.11 as UART pin
55-
UrtCfg(pADI_UART0, 57600, (BITM_UART_COMLCR_WLS | 3), 0); // Configure UART for 57600 baud rate
56-
UrtFifoCfg(pADI_UART0, RX_FIFO_1BYTE, // Configure the UART FIFOs for 8 bytes deep
53+
DioCfgPin(pADI_GPIO0, PIN10, 1); // Setup P0.10 as UART pin
54+
DioCfgPin(pADI_GPIO0, PIN11, 1); // Setup P0.11 as UART pin
55+
UrtCfg(pADI_UART0, B115200, (BITM_UART_COMLCR_WLS | 3), 0); // Configure UART for 115200 baud rate
56+
UrtFifoCfg(pADI_UART0, RX_FIFO_1BYTE, // Configure the UART FIFOs for 8 bytes deep
5757
BITM_UART_COMFCR_FIFOEN);
5858
UrtFifoClr(pADI_UART0, BITM_UART_COMFCR_RFCLR // Clear the Rx/TX FIFOs
5959
| BITM_UART_COMFCR_TFCLR);
@@ -155,6 +155,7 @@ lf_ret_t PlatformAducm355_wait_until(Platform *super, instant_t wakeup_time) {
155155
interval_t duration = wakeup_time - super->get_physical_time(super);
156156
if (duration <= CLOCK_MIN_HIBERNATE_DURATION) {
157157
while (super->get_physical_time(super) < wakeup_time) {
158+
busy_wait(100000);
158159
}
159160
return LF_OK;
160161
}
@@ -188,6 +189,7 @@ lf_ret_t PlatformAducm355_wait_until_interruptible_locked(Platform *super, insta
188189
self->new_async_event = false;
189190
super->leave_critical_section(super);
190191
while (super->get_physical_time(super) < wakeup_time && !self->new_async_event) {
192+
busy_wait(100000);
191193
}
192194
super->enter_critical_section(super);
193195

0 commit comments

Comments
 (0)