diff --git a/epicardium/cdcacm.c b/epicardium/cdcacm.c
index 19b1dcfeca2df30f18cbb15d062e7783ecdd4ea6..cead3780e96b47308e96887f1a18fd8990fc8082 100644
--- a/epicardium/cdcacm.c
+++ b/epicardium/cdcacm.c
@@ -199,10 +199,14 @@ uint8_t cdcacm_read(void)
 
 void cdcacm_write(uint8_t *data, int len)
 {
-    while (acm_present()) {
-        // TODO: This might fail horribly
-        if (acm_write(data, len) == len) {
-            break;
+    static int lockup_disable = 0;
+    if (acm_present() && !lockup_disable) {
+        int ret = acm_write(data, len);
+        if (ret < 0) {
+            LOG_ERR("cdcacm", "fifo lockup detected");
+            lockup_disable = 1;
+        } else if (ret != len) {
+            LOG_WARN("cdcacm", "write length mismatch, got %d", ret);
         }
     }
 }
diff --git a/lib/sdk/Libraries/MAXUSB/src/devclass/cdc_acm.c b/lib/sdk/Libraries/MAXUSB/src/devclass/cdc_acm.c
index 92bf8df2957e57535c36d1ec03f30326f57f776f..c85ca2b84faa50015cd4ab1019f4d42321074cf1 100644
--- a/lib/sdk/Libraries/MAXUSB/src/devclass/cdc_acm.c
+++ b/lib/sdk/Libraries/MAXUSB/src/devclass/cdc_acm.c
@@ -329,10 +329,12 @@ int acm_read(uint8_t *buf, unsigned int len)
 int acm_write(uint8_t *buf, unsigned int len)
 {
   unsigned int i = 0;
+  unsigned int failcount = 0;
 
   /* Write data into the FIFO */
   while (len > 0) {
     if (fifo_put8(&wfifo, buf[i]) == 0) {
+      failcount = 0;
       /* Success */
       i++; len--;
     } else {
@@ -340,6 +342,10 @@ int acm_write(uint8_t *buf, unsigned int len)
       if (wreq.reqlen == 0) {
 	svc_in_to_host(&wreq);
       }
+
+      if (failcount++ > 4096) {
+        return -1;
+      }
     }
   }