I am feeling my way around programming a Wixel board. The program below is based on example_usb_com.c. It should send string “AB” every 2 seconds to the com port. It doesn’t work and the Wixel board becomes invisible to the computer as soon as I upload the program. Any help is appreciated.
/** To send "AB" every 2 seconds to the com port. */
#include <wixel.h>
#include <usb.h>
#include <usb_com.h>
#include <stdio.h>
uint8 XDATA response[32];
void main()
{
uint32 time;
uint8 bytesLeft;
systemInit();
usbInit();
while(1)
{
boardService();
usbShowStatusWithGreenLed();
usbComService();
bytesLeft = usbComRxAvailable();
response[0] = 'A';
response[1] = 'B';
if (usbComTxAvailable()) {
usbComTxSend(response,2);
}
time = getMs();
while ((getMs() - time) < 2000);
}
}