USB CDC goes medical

The FSL_USB_Stack Processor Expert component (see USB CDC reloaded) has been extended to support USB CDC for the Freescale S08MM128 targeted for medical devices:

Choice of devices

Choice of devices

In the FSL_USB_Stack I can now select the MC9S08MM128 both for small and banked memory models:

Component Properties

Component Properties

I used a TWR-S08MM128 board with the TWR-SER board. The picture shows the green S08MM128 board in the front connected through the TWR-ELEV board to the TWR-SER board. Attached to the TWR-SER board is the USB cable for USB communication and powering the boards.

TWR-S08MM128 board with USB CDC

TWR-S08MM128 board with USB CDC

A demo application is available (see links below). The application echos received characters on the host console:

/*
 * cdc_demo.c
 */

#include "cdc_demo.h"
#include "USB1.h"
#include "LED1.h"
#include "LED2.h"

static uint8_t cdc_buffer[USB1_DATA_BUFF_SIZE];
static uint8_t in_buffer[USB1_DATA_BUFF_SIZE];

void CDC_Run(void) {
  int i;

  for(;;) {
    while(USB1_App_Task(cdc_buffer, sizeof(cdc_buffer))==ERR_BUSOFF) {
      /* device not enumerated */
      LED1_Neg(); LED2_Off();
    }
    LED1_Off(); LED2_Neg();
    if (USB1_GetCharsInRxBuf()!=0) {
      i = 0;
      while(   i<sizeof(in_buffer)-1
            && USB1_GetChar(&in_buffer[i])==ERR_OK
           )
      {
        i++;
      }
      in_buffer[i] = '\0';
      (void)USB1_SendString((unsigned char*)"echo: ");
      (void)USB1_SendString(in_buffer);
      (void)USB1_SendString((unsigned char*)"\r\n");
    }
  }
}

The result is then shown in the host console:

USB CDC connection to S08MM128

USB CDC connection to S08MM128

Note: It is important that USB1_App_Task() is called early and often. Otherwise the USB device might not be recognized by the host.

Links:

Happy USBinging đŸ™‚

4 thoughts on “USB CDC goes medical

  1. Pingback: CRC Calculation with MCU10 | MCU on Eclipse

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.