Hi!
Thanks for the reply. I have used the example to find that the code does compile but I am not able to get the connection done. If you could refer the example:
#include "board.h"
#include <stdio.h>
#include <string.h>
#include "libusbdev.h"
/* The size of the packet buffer. */
#define PACKET_BUFFER_SIZE 4096
/* Application defined LUSB interrupt status */
#define LUSB_DATA_PENDING _BIT(0)
/* Packet buffer for processing */
static uint8_t g_rxBuff[PACKET_BUFFER_SIZE];
int main(void)
{
/* Initialize board and chip */
SystemCoreClockUpdate();
Board_Init();
/* Init USB subsystem and LibUSBDevice */
libusbdev_init(USB_STACK_MEM_BASE, USB_STACK_MEM_SIZE);
while (1) {
/* wait until host is connected */
while (libusbdev_Connected() == 0) {
/* Sleep until next IRQ happens */ -----------> The code keeps staying here. The usb never gets connected.
__WFI();
}
while (libusbdev_Connected()) {
if (libusbdev_QueueReadDone() != -1) {
/* Dummy process read data ......*/
/* requeue read request */
libusbdev_QueueReadReq(g_rxBuff, PACKET_BUFFER_SIZE);
}
if (libusbdev_QueueSendDone() == 0) {
/* Queue send request */
libusbdev_QueueSendReq(g_rxBuff, PACKET_BUFFER_SIZE);
}
}
}
}
If you could give a step by step explanation of what to do, it would be very helpful for a lot of people like me.