Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC

2019-05-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13673 )

Change subject: switch UART_debug to ASYNC
..

switch UART_debug to ASYNC

using the synchronous HAL library causes RX overflow after 5 bytes
on bulk incoming data (e.g. pasted).
this mainly due to printing synchronously the character, but to
further prevent congestion we switch to asynchronous (e.g.
interrupt driven) communication.

The RX part works great now (no overflow), but the TX part is
malfunctioning because the HAL Async library does not buffer the
data to be transmitted and expects it to be in memory until
the transmission is complete (which printf does not do).

This change will not be reflected in Atmel START since it does not
allow to set the underlying STDIO redirect peripheral to async.

Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
---
M sysmoOCTSIM/command.c
M sysmoOCTSIM/driver_init.c
M sysmoOCTSIM/driver_init.h
M sysmoOCTSIM/hpl/sercom/hpl_sercom.c
M sysmoOCTSIM/main.c
M sysmoOCTSIM/manual_test.c
M sysmoOCTSIM/stdio_start.c
7 files changed, 73 insertions(+), 22 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/sysmoOCTSIM/command.c b/sysmoOCTSIM/command.c
index b0949f3..6fa25cf 100644
--- a/sysmoOCTSIM/command.c
+++ b/sysmoOCTSIM/command.c
@@ -81,7 +81,7 @@
unsigned int i = 0;

/* yield CPU after maximum of 10 received characters */
-   while (usart_sync_is_rx_not_empty(_debug) && (i < 10)) {
+   while (usart_async_is_rx_not_empty(_debug) && (i < 10)) {
int c = getchar();
if (c < 0)
return;
diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c
index 726129d..8a50925 100644
--- a/sysmoOCTSIM/driver_init.c
+++ b/sysmoOCTSIM/driver_init.c
@@ -32,6 +32,9 @@
 /*! The buffer size for USART */
 #define SIM6_BUFFER_SIZE 16

+/*! The buffer size for USART */
+#define UART_DEBUG_BUFFER_SIZE 32
+
 struct usart_async_descriptor SIM0;
 struct usart_async_descriptor SIM1;
 struct usart_async_descriptor SIM2;
@@ -48,7 +51,9 @@
 static uint8_t SIM5_buffer[SIM5_BUFFER_SIZE];
 static uint8_t SIM6_buffer[SIM6_BUFFER_SIZE];

-struct usart_sync_descriptor UART_debug;
+struct usart_async_descriptor UART_debug;
+
+static uint8_t UART_DEBUG_buffer[UART_DEBUG_BUFFER_SIZE];

 /**
  * \brief USART Clock initialization function
@@ -309,7 +314,26 @@
SIM6_PORT_init();
 }

-void UART_debug_PORT_init(void)
+/**
+ * \brief USART Clock initialization function
+ *
+ * Enables register interface and peripheral clock
+ */
+void UART_debug_CLOCK_init()
+{
+
+   hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_CORE, 
CONF_GCLK_SERCOM7_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
+   hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_SLOW, 
CONF_GCLK_SERCOM7_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
+
+   hri_mclk_set_APBDMASK_SERCOM7_bit(MCLK);
+}
+
+/**
+ * \brief USART pinmux initialization function
+ *
+ * Set each required pin to USART functionality
+ */
+void UART_debug_PORT_init()
 {

gpio_set_pin_function(UART_TX, PINMUX_PB30C_SERCOM7_PAD0);
@@ -317,18 +341,15 @@
gpio_set_pin_function(UART_RX, PINMUX_PB31C_SERCOM7_PAD1);
 }

-void UART_debug_CLOCK_init(void)
-{
-   hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_CORE, 
CONF_GCLK_SERCOM7_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
-   hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_SLOW, 
CONF_GCLK_SERCOM7_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
-
-   hri_mclk_set_APBDMASK_SERCOM7_bit(MCLK);
-}
-
+/**
+ * \brief USART initialization function
+ *
+ * Enables USART peripheral, clocks and initializes USART driver
+ */
 void UART_debug_init(void)
 {
UART_debug_CLOCK_init();
-   usart_sync_init(_debug, SERCOM7, (void *)NULL);
+   usart_async_init(_debug, SERCOM7, UART_DEBUG_buffer, 
UART_DEBUG_BUFFER_SIZE, (void *)NULL);
UART_debug_PORT_init();
 }
 
diff --git a/sysmoOCTSIM/driver_init.h b/sysmoOCTSIM/driver_init.h
index d809db8..9d009b9 100644
--- a/sysmoOCTSIM/driver_init.h
+++ b/sysmoOCTSIM/driver_init.h
@@ -40,8 +40,7 @@
 extern struct usart_async_descriptor SIM4;
 extern struct usart_async_descriptor SIM5;
 extern struct usart_async_descriptor SIM6;
-
-extern struct usart_sync_descriptor UART_debug;
+extern struct usart_async_descriptor UART_debug;

 void SIM0_PORT_init(void);
 void SIM0_CLOCK_init(void);
diff --git a/sysmoOCTSIM/hpl/sercom/hpl_sercom.c 
b/sysmoOCTSIM/hpl/sercom/hpl_sercom.c
index b14e720..f235115 100644
--- a/sysmoOCTSIM/hpl/sercom/hpl_sercom.c
+++ b/sysmoOCTSIM/hpl/sercom/hpl_sercom.c
@@ -177,6 +177,8 @@

 static struct _usart_async_device *_sercom6_dev = NULL;

+static struct _usart_async_device *_sercom7_dev = NULL;
+
 static uint8_t _get_sercom_index(const void *const hw);
 static uint8_t _sercom_get_irq_num(const void *const hw);
 static void

Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC

2019-05-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13673 )

Change subject: switch UART_debug to ASYNC
..


Patch Set 9: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13673
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
Gerrit-Change-Number: 13673
Gerrit-PatchSet: 9
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Kévin Redon 
Gerrit-Comment-Date: Thu, 09 May 2019 14:37:02 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC

2019-05-09 Thread Kévin Redon
Kévin Redon has posted comments on this change. ( 
https://gerrit.osmocom.org/13673 )

Change subject: switch UART_debug to ASYNC
..


Patch Set 9:

> I still don't like the fact that this looses serial output pretty
 > much all the time (e.g. if you type 'help' at the command line).

fixed in https://gerrit.osmocom.org/#/c/osmo-ccid-firmware/+/13677/ patchset 
10. the new async lib with tx buffer is now blocking when the buffer is full.
I did not implemented a warning for buffer "overflow", but the buffer is 
already quite large and I saw it blocking only with very large text (e.g. help).


--
To view, visit https://gerrit.osmocom.org/13673
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
Gerrit-Change-Number: 13673
Gerrit-PatchSet: 9
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Kévin Redon 
Gerrit-Comment-Date: Thu, 09 May 2019 13:39:27 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC

2019-05-02 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13673 )

Change subject: switch UART_debug to ASYNC
..


Patch Set 9: Code-Review-1

I still don't like the fact that this looses serial output pretty much all the 
time (e.g. if you type 'help' at the command line).

I would prefer if the mechanism would use buffered writes, but end up blocking 
in case the write buffer is full - rather than simply dropping log output

We can introduce a global counter of how often this blocking occurs and 
possibly use that counter (manually) to increase the #define for the buffer 
size if needed.


--
To view, visit https://gerrit.osmocom.org/13673
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
Gerrit-Change-Number: 13673
Gerrit-PatchSet: 9
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 02 May 2019 15:02:46 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC

2019-04-18 Thread Kévin Redon
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/13673

to look at the new patch set (#9).

Change subject: switch UART_debug to ASYNC
..

switch UART_debug to ASYNC

using the synchronous HAL library causes RX overflow after 5 bytes
on bulk incoming data (e.g. pasted).
this mainly due to printing synchronously the character, but to
further prevent congestion we switch to asynchronous (e.g.
interrupt driven) communication.

The RX part works great now (no overflow), but the TX part is
malfunctioning because the HAL Async library does not buffer the
data to be transmitted and expects it to be in memory until
the transmission is complete (which printf does not do).

This change will not be reflected in Atmel START since it does not
allow to set the underlying STDIO redirect peripheral to async.

Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
---
M sysmoOCTSIM/command.c
M sysmoOCTSIM/driver_init.c
M sysmoOCTSIM/driver_init.h
M sysmoOCTSIM/hpl/sercom/hpl_sercom.c
M sysmoOCTSIM/main.c
M sysmoOCTSIM/manual_test.c
M sysmoOCTSIM/stdio_start.c
7 files changed, 73 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/73/13673/9
--
To view, visit https://gerrit.osmocom.org/13673
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
Gerrit-Change-Number: 13673
Gerrit-PatchSet: 9
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC

2019-04-17 Thread Kévin Redon
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/13673

to look at the new patch set (#8).

Change subject: switch UART_debug to ASYNC
..

switch UART_debug to ASYNC

using the synchronous HAL library causes RX overflow after 5 bytes
on bulk incoming data (e.g. pasted).
this mainly due to printing synchronously the character, but to
further prevent congestion we switch to asynchronous (e.g.
interrupt driven) communication.

The RX part works great now (no overflow), but the TX part is
malfunctioning because the HAL Async library does not buffer the
data to be transmitted and expects it to be in memory until
the transmission is complete (which printf does not do).

This change will not be reflected in Atmel START since it does not
allow to set the underlying STDIO redirect peripheral to async.

Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
---
M sysmoOCTSIM/command.c
M sysmoOCTSIM/driver_init.c
M sysmoOCTSIM/driver_init.h
M sysmoOCTSIM/hpl/sercom/hpl_sercom.c
M sysmoOCTSIM/main.c
M sysmoOCTSIM/manual_test.c
M sysmoOCTSIM/stdio_start.c
7 files changed, 75 insertions(+), 106 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/73/13673/8
--
To view, visit https://gerrit.osmocom.org/13673
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
Gerrit-Change-Number: 13673
Gerrit-PatchSet: 8
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC

2019-04-17 Thread Harald Welte
Harald Welte has uploaded a new patch set (#6) to the change originally created 
by Kévin Redon. ( https://gerrit.osmocom.org/13673 )

Change subject: switch UART_debug to ASYNC
..

switch UART_debug to ASYNC

using the synchronous HAL library causes RX overflow after 5 bytes
on bulk incoming data (e.g. pasted).
this mainly due to printing synchronously the character, but to
further prevent congestion we switch to asynchronous (e.g.
interrupt driven) communication.

The RX part works great now (no overflow), but the TX part is
malfunctioning because the HAL Async library does not buffer the
data to be transmitted and expects it to be in memory until
the transmission is complete (which printf does not do).

This change will not be reflected in Atmel START since it does not
allow to set the underlying STDIO redirect peripheral to async.

Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
---
M sysmoOCTSIM/command.c
M sysmoOCTSIM/driver_init.c
M sysmoOCTSIM/driver_init.h
M sysmoOCTSIM/hpl/sercom/hpl_sercom.c
M sysmoOCTSIM/main.c
M sysmoOCTSIM/manual_test.c
M sysmoOCTSIM/stdio_start.c
7 files changed, 75 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/73/13673/6
--
To view, visit https://gerrit.osmocom.org/13673
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
Gerrit-Change-Number: 13673
Gerrit-PatchSet: 6
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC

2019-04-17 Thread Kévin Redon
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/13673

to look at the new patch set (#5).

Change subject: switch UART_debug to ASYNC
..

switch UART_debug to ASYNC

using the synchronous HAL library causes RX overflow after 5 bytes
on bulk incoming data (e.g. pasted).
this mainly due to printing synchronously the character, but to
further prevent congestion we switch to asynchronous (e.g.
interrupt driven) communication.

The RX part works great now (no overflow), but the TX part is
malfunctioning because the HAL Async library does not buffer the
data to be transmitted and expects it to be in memory until
the transmission is complete (which printf does not do).

This change will not be reflected in Atmel START since it does not
allow to set the underlying STDIO redirect peripheral to async.

Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
---
M sysmoOCTSIM/command.c
M sysmoOCTSIM/driver_init.c
M sysmoOCTSIM/driver_init.h
M sysmoOCTSIM/hpl/sercom/hpl_sercom.c
M sysmoOCTSIM/main.c
M sysmoOCTSIM/manual_test.c
M sysmoOCTSIM/stdio_start.c
7 files changed, 75 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/73/13673/5
--
To view, visit https://gerrit.osmocom.org/13673
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
Gerrit-Change-Number: 13673
Gerrit-PatchSet: 5
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC

2019-04-17 Thread Harald Welte
Harald Welte has uploaded a new patch set (#4) to the change originally created 
by Kévin Redon. ( https://gerrit.osmocom.org/13673 )

Change subject: switch UART_debug to ASYNC
..

switch UART_debug to ASYNC

using the synchronous HAL library causes RX overflow after 5 bytes
on bulk incoming data (e.g. pasted).
this mainly due to printing synchronously the character, but to
further prevent congestion we switch to asynchronous (e.g.
interrupt driven) communication.

The RX part works great now (no overflow), but the TX part is
malfunctioning because the HAL Async library does not buffer the
data to be transmitted and expects it to be in memory until
the transmission is complete (which printf does not do).

This change will not be reflected in Atmel START since it does not
allow to set the underlying STDIO redirect peripheral to async.

Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
---
M sysmoOCTSIM/command.c
M sysmoOCTSIM/driver_init.c
M sysmoOCTSIM/driver_init.h
M sysmoOCTSIM/hpl/sercom/hpl_sercom.c
M sysmoOCTSIM/main.c
M sysmoOCTSIM/manual_test.c
M sysmoOCTSIM/stdio_start.c
7 files changed, 75 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/73/13673/4
--
To view, visit https://gerrit.osmocom.org/13673
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
Gerrit-Change-Number: 13673
Gerrit-PatchSet: 4
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC

2019-04-17 Thread Harald Welte
Harald Welte has uploaded a new patch set (#3) to the change originally created 
by Kévin Redon. ( https://gerrit.osmocom.org/13673 )

Change subject: switch UART_debug to ASYNC
..

switch UART_debug to ASYNC

using the synchronous HAL library causes RX overflow after 5 bytes
on bulk incoming data (e.g. pasted).
this mainly due to printing synchronously the character, but to
further prevent congestion we switch to asynchronous (e.g.
interrupt driven) communication.

The RX part works great now (no overflow), but the TX part is
malfunctioning because the HAL Async library does not buffer the
data to be transmitted and expects it to be in memory until
the transmission is complete (which printf does not do).

This change will not be reflected in Atmel START since it does not
allow to set the underlying STDIO redirect peripheral to async.

Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
---
M sysmoOCTSIM/command.c
M sysmoOCTSIM/driver_init.c
M sysmoOCTSIM/driver_init.h
M sysmoOCTSIM/examples/driver_examples.c
M sysmoOCTSIM/hpl/sercom/hpl_sercom.c
M sysmoOCTSIM/main.c
M sysmoOCTSIM/stdio_start.c
7 files changed, 94 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/73/13673/3
--
To view, visit https://gerrit.osmocom.org/13673
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
Gerrit-Change-Number: 13673
Gerrit-PatchSet: 3
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ccid-firmware[master]: switch UART_debug to ASYNC

2019-04-16 Thread Kévin Redon
Kévin Redon has uploaded this change for review. ( 
https://gerrit.osmocom.org/13673


Change subject: switch UART_debug to ASYNC
..

switch UART_debug to ASYNC

using the synchronous HAL library causes RX overflow after 5 bytes
on bulk incoming data (e.g. pasted).
this mainly due to printing synchronously the character, but to
further prevent congestion we switch to asynchronous (e.g.
interrupt driven) communication.

The RX part works great now (no overflow), but the TX part is
malfunctioning because the HAL Async library does not buffer the
data to be transmitted and expects it to be in memory until
the transmission is complete (which printf does not do).

This change will not be reflected in Atmel START since it does not
allow to set the underlying STDIO redirect peripheral to async.

Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
---
M sysmoOCTSIM/command.c
M sysmoOCTSIM/driver_init.c
M sysmoOCTSIM/driver_init.h
M sysmoOCTSIM/examples/driver_examples.c
M sysmoOCTSIM/hpl/sercom/hpl_sercom.c
M sysmoOCTSIM/main.c
M sysmoOCTSIM/stdio_start.c
7 files changed, 94 insertions(+), 28 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/73/13673/1

diff --git a/sysmoOCTSIM/command.c b/sysmoOCTSIM/command.c
index 9502f05..7ac5662 100644
--- a/sysmoOCTSIM/command.c
+++ b/sysmoOCTSIM/command.c
@@ -76,7 +76,8 @@
unsigned int i = 0;

/* yield CPU after maximum of 10 received characters */
-   while (usart_sync_is_rx_not_empty(_debug) && (i < 10)) {
+   while (usart_async_is_rx_not_empty(_debug) && (i < 10)) {
+   gpio_toggle_pin_level(USER_LED); // toggle LED to show we 
received something
int c = getchar();
if (c < 0)
return;
diff --git a/sysmoOCTSIM/driver_init.c b/sysmoOCTSIM/driver_init.c
index 06184ee..0d5bb53 100644
--- a/sysmoOCTSIM/driver_init.c
+++ b/sysmoOCTSIM/driver_init.c
@@ -32,6 +32,9 @@
 /*! The buffer size for USART */
 #define SIM6_BUFFER_SIZE 16

+/*! The buffer size for USART */
+#define UART_DEBUG_BUFFER_SIZE 32
+
 struct usart_async_descriptor SIM0;
 struct usart_async_descriptor SIM1;
 struct usart_async_descriptor SIM2;
@@ -48,7 +51,9 @@
 static uint8_t SIM5_buffer[SIM5_BUFFER_SIZE];
 static uint8_t SIM6_buffer[SIM6_BUFFER_SIZE];

-struct usart_sync_descriptor UART_debug;
+struct usart_async_descriptor UART_debug;
+
+static uint8_t UART_DEBUG_buffer[UART_DEBUG_BUFFER_SIZE];

 /**
  * \brief USART Clock initialization function
@@ -309,7 +314,26 @@
SIM6_PORT_init();
 }

-void UART_debug_PORT_init(void)
+/**
+ * \brief USART Clock initialization function
+ *
+ * Enables register interface and peripheral clock
+ */
+void UART_debug_CLOCK_init()
+{
+
+   hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_CORE, 
CONF_GCLK_SERCOM7_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
+   hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_SLOW, 
CONF_GCLK_SERCOM7_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
+
+   hri_mclk_set_APBDMASK_SERCOM7_bit(MCLK);
+}
+
+/**
+ * \brief USART pinmux initialization function
+ *
+ * Set each required pin to USART functionality
+ */
+void UART_debug_PORT_init()
 {

gpio_set_pin_function(UART_TX, PINMUX_PB30C_SERCOM7_PAD0);
@@ -317,18 +341,15 @@
gpio_set_pin_function(UART_RX, PINMUX_PB31C_SERCOM7_PAD1);
 }

-void UART_debug_CLOCK_init(void)
-{
-   hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_CORE, 
CONF_GCLK_SERCOM7_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
-   hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM7_GCLK_ID_SLOW, 
CONF_GCLK_SERCOM7_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos));
-
-   hri_mclk_set_APBDMASK_SERCOM7_bit(MCLK);
-}
-
+/**
+ * \brief USART initialization function
+ *
+ * Enables USART peripheral, clocks and initializes USART driver
+ */
 void UART_debug_init(void)
 {
UART_debug_CLOCK_init();
-   usart_sync_init(_debug, SERCOM7, (void *)NULL);
+   usart_async_init(_debug, SERCOM7, UART_DEBUG_buffer, 
UART_DEBUG_BUFFER_SIZE, (void *)NULL);
UART_debug_PORT_init();
 }

diff --git a/sysmoOCTSIM/driver_init.h b/sysmoOCTSIM/driver_init.h
index d809db8..9d009b9 100644
--- a/sysmoOCTSIM/driver_init.h
+++ b/sysmoOCTSIM/driver_init.h
@@ -40,8 +40,7 @@
 extern struct usart_async_descriptor SIM4;
 extern struct usart_async_descriptor SIM5;
 extern struct usart_async_descriptor SIM6;
-
-extern struct usart_sync_descriptor UART_debug;
+extern struct usart_async_descriptor UART_debug;

 void SIM0_PORT_init(void);
 void SIM0_CLOCK_init(void);
diff --git a/sysmoOCTSIM/examples/driver_examples.c 
b/sysmoOCTSIM/examples/driver_examples.c
index 4ab0ef4..14f1ae5 100644
--- a/sysmoOCTSIM/examples/driver_examples.c
+++ b/sysmoOCTSIM/examples/driver_examples.c
@@ -215,12 +215,29 @@
 
 /**
  * Example of using UART_debug to write "Hello World" using the IO abstraction.
+ *
+ * Since the driver is asynchronous we need to use