BiVo EFM32GG12  0.1
An open source foundation foundation for remote monitoring of bird vocalizations.
serial_usb_drv.c File Reference

Serial USB Driver. More...

#include "serial_usb_drv.h"

Functions

void serialUsbDriver_init (void)
 Initializes the USART and GPIO peripherals for using the SEGGER JLINK chip as a a virtual communication (VCOM) port over the DBG USB port and initializes pointers to input and output buffers. More...
 
enum USB_Ecode transmit_HalfWord (int16_t *buffer, uint32_t size)
 
enum USB_Ecode transmit_Byte (int8_t *buffer, uint32_t size)
 
enum USB_Ecode receive_Byte (int8_t *buffer, uint32_t size)
 

Detailed Description

Serial USB Driver.

This driver manages the specific functionalities needed to run a serial link to the desktop application over a USB cable using the debug chip's virtual communication port. The Thunderboard has two micro-USB ports, the VCOM connects to the port on the debug side of the board.

This code is adapted in part from the leuart_echo peripheral example from by Silicon Labs and the LDMA example code by Silicon Labs. github.com/SiliconLabs/peripheral_examples/tree/master/series1/leuart/leuart_echo. https://docs.silabs.com/mcu/5.8/efm32gg12/group-LDMA#ga0b27c0375b6e3f6a862f9317a7d04fba.

Authors
Kevin Imlay
Date
2-16-21
Todo:

Figure out how to include parameters for the RX and TX callback functions.

Assess if possible to send and receive concurrently.

Note
Do not try to send messages too quickly. Messages may be truncated if transmission to the board begins before the board begins it's receive transmission operation. I recommend allowing at least 1 ms delay from the a received transmission from the board to sending the next transmission to the board.

Function Documentation

◆ receive_Byte()

enum USB_Ecode receive_Byte ( int8_t *  buffer,
uint32_t  size 
)

Receive a byte at a time over the serial connection. This is useful to receive strings.

Parameters
bufferBuffer of bytes (or byte sized) to store the received message into.
sizeThe number of bytes to receive.

◆ serialUsbDriver_init()

void serialUsbDriver_init ( void  )

Initializes the USART and GPIO peripherals for using the SEGGER JLINK chip as a a virtual communication (VCOM) port over the DBG USB port and initializes pointers to input and output buffers.

This initialization must be run before any other functions can be called that control the serial communication.

◆ transmit_Byte()

enum USB_Ecode transmit_Byte ( int8_t *  buffer,
uint32_t  size 
)

Transmit a byte at a time over the serial connection. This is useful to send strings.

Parameters
bufferBuffer of bytes (or byte sized) to transmit over the serial connection.
sizeThe number of bytes to transmit.

◆ transmit_HalfWord()

enum USB_Ecode transmit_HalfWord ( int16_t *  buffer,
uint32_t  size 
)

Transmit half a word at a time over the serial connection. This is useful to send audio samples, as samples are half words.

Parameters
bufferBuffer of half words to transmit over the serial connection.
sizeThe number of half words to transmit.