CDC Class added to USB Device Library!
CDC Class added to USB Device Library!
CDC Class added to USB Device Library!
USB Device library gets a new addition - Communications Device Class.
The comprehensive new USB Device Library gets a great update. Upon your request, we have
added Communication Device Class (CDC). We provided Virtual COM port example as a quick starter
project to help you get around easily. Make sure to visit Libstock and download the new update now!
Yours sincerely,
mikroElektronika
USB Device library gets a new addition - Communications Device Class.
The comprehensive new USB Device Library gets a great update. Upon your request, we have
added Communication Device Class (CDC). We provided Virtual COM port example as a quick starter
project to help you get around easily. Make sure to visit Libstock and download the new update now!
Yours sincerely,
mikroElektronika
Web Department Manager
Re: CDC Class added to USB Device Library!
Very nice addition. I've done a quick test and it works well. But I have a little question. I have noticed that VID is 0x0000 and PID is 0x0400, can this be changed if someone has is own VID/PID ?
Serge T.
Learning is an endeless process but it must start somewhere!
Learning is an endeless process but it must start somewhere!
Re: CDC Class added to USB Device Library!
Open up the PC driver info file VCPDriver.inf in Notepad and change both the PID and VID numbers. Open the mC VCD_Descriptor.c file in Notepad or mE IDE and change the idVendor and idProduct numbers. Recompile mE code and load it onto the target MCU. Go to the PC Control Panel Hardware manager and re-install the driver for the mE serial port. Connect target board to PC.
rus51
rus51
Re: CDC Class added to USB Device Library!
Thanks rus51.
Serge T.
Learning is an endeless process but it must start somewhere!
Learning is an endeless process but it must start somewhere!
Re: CDC Class added to USB Device Library!
Thanks ME !
Re: CDC Class added to USB Device Library!
Thanks, good library...
HELP CDC Class added to USB Device Library!
How do I send a string on the show?I can not send...
I tried several methods but nothing...
/*
* Project name:
Virtual COM Port Demo
* Description
Example showing usage USB CDC device that functions as a generic virtual
COM port. The example echoes data sent via USART terminal.
* Test configuration:
MCU: P18F4550
dev.board: EasyPIC v7 Connectivity
http://www.mikroe.com/easypic/
Oscillator: HS-PLL, 48.000MHz
Ext. Modules: None.
SW: mikroC PRO for PIC
http://www.mikroe.com/mikroc/pic/
Notes: Example uses CDC Driver included in Windows. An .inf file
is supplied with the example in order to match the driver
with this device (user must guide driver installation
wizard to the VCPDriver folder).
*/
#include <stdint.h>
// Buffer of 64 bytes
char buffer[64] absolute 0x500;
char aa[64];
// USB interrupt service routine
void interrupt(){
// Call library interrupt handler routine
USBDev_IntHandler();
}
void USBDev_CDCParamsChanged(){
}
extern const uint8_t _USB_CDC_BULK_EP_IN; // Data interface IN endpoint
extern const uint8_t _USB_CDC_BULK_EP_OUT; // Data interface OUT endpoint
uint8_t dataReceived = 0;
uint16_t dataReceivedSize;
void USBDev_CDCDataReceived(uint16_t size){
dataReceived = 1;
dataReceivedSize = size;
}
void main(void){
ADCON1 |= 0x0F; // Configure all ports with analog function as digital
CMCON |= 7; // Disable comparators
// Initialize CDC Class
USBDev_CDCInit();
// Initialize USB device module
USBDev_Init();
// Enable USB device interrupt
IPEN_bit = 1;
USBIP_bit = 1;
USBIE_bit = 1;
GIEH_bit = 1;
// Wait until device is configured (enumeration is successfully finished)
while(USBDev_GetDeviceState() != _USB_DEV_STATE_CONFIGURED)
;
// Set receive buffer where received data is stored
USBDev_CDCSetReceiveBuffer(buffer);
// Infinite loop
while(1){
if(dataReceived == 1){
dataReceived = 0;
// Send back received packet
USBDev_CDCSetReceiveBuffer(buffer);
USBDev_CDCSendData(buffer, dataReceivedSize);
}
USBDev_CDCSendData("dasf", 10);///not work correct
delay_ms(1000);
}
}
I tried several methods but nothing...
/*
* Project name:
Virtual COM Port Demo
* Description
Example showing usage USB CDC device that functions as a generic virtual
COM port. The example echoes data sent via USART terminal.
* Test configuration:
MCU: P18F4550
dev.board: EasyPIC v7 Connectivity
http://www.mikroe.com/easypic/
Oscillator: HS-PLL, 48.000MHz
Ext. Modules: None.
SW: mikroC PRO for PIC
http://www.mikroe.com/mikroc/pic/
Notes: Example uses CDC Driver included in Windows. An .inf file
is supplied with the example in order to match the driver
with this device (user must guide driver installation
wizard to the VCPDriver folder).
*/
#include <stdint.h>
// Buffer of 64 bytes
char buffer[64] absolute 0x500;
char aa[64];
// USB interrupt service routine
void interrupt(){
// Call library interrupt handler routine
USBDev_IntHandler();
}
void USBDev_CDCParamsChanged(){
}
extern const uint8_t _USB_CDC_BULK_EP_IN; // Data interface IN endpoint
extern const uint8_t _USB_CDC_BULK_EP_OUT; // Data interface OUT endpoint
uint8_t dataReceived = 0;
uint16_t dataReceivedSize;
void USBDev_CDCDataReceived(uint16_t size){
dataReceived = 1;
dataReceivedSize = size;
}
void main(void){
ADCON1 |= 0x0F; // Configure all ports with analog function as digital
CMCON |= 7; // Disable comparators
// Initialize CDC Class
USBDev_CDCInit();
// Initialize USB device module
USBDev_Init();
// Enable USB device interrupt
IPEN_bit = 1;
USBIP_bit = 1;
USBIE_bit = 1;
GIEH_bit = 1;
// Wait until device is configured (enumeration is successfully finished)
while(USBDev_GetDeviceState() != _USB_DEV_STATE_CONFIGURED)
;
// Set receive buffer where received data is stored
USBDev_CDCSetReceiveBuffer(buffer);
// Infinite loop
while(1){
if(dataReceived == 1){
dataReceived = 0;
// Send back received packet
USBDev_CDCSetReceiveBuffer(buffer);
USBDev_CDCSendData(buffer, dataReceivedSize);
}
USBDev_CDCSendData("dasf", 10);///not work correct
delay_ms(1000);
}
}
Re: CDC Class added to USB Device Library!
i solved with next function:
thanks...
Code: Select all
void SendUart(char aa[64])
{
int i;
for(i = 0; i<strlen(aa); i++)
{
buffer[i] = aa[i];
}
USBDev_CDCSendData(buffer, strlen(aa));
}
thanks...
Re: CDC Class added to USB Device Library!
I appologize if this question is out of topic (also, I have just written a new post regarding my question below, which is waiting for aproval).
I have just purchased EasyPic Fusion v7 board, as I will need to develop a new printer with USB and Ethernet capabilities. As I would like to start with the USB part of the project, after reading lots and lots of tutorials and Application Notes, sometimes I think I am getting even more confused.
From what I could understand, 99,9% of the examples I found develop the projects considering the HID class, as there are plenty of usb-ready device libraries with simple functions to be used. Also, there is no need to develop custom host-side drivers, as any OS already has HID drivers. So, people just build some blinking led project on top of this HID class, using some very simple functions, such as HID_Enable, etc...
However, if I need to develop some device hardware that is not classified as HID, how do I start? Is there any kind of USB device library to use, or do I need to write every single function from scratch?
Can I use Mikroelektronika's USB library to write firmware for non-HID devices?
Thank you all in advance.
I have just purchased EasyPic Fusion v7 board, as I will need to develop a new printer with USB and Ethernet capabilities. As I would like to start with the USB part of the project, after reading lots and lots of tutorials and Application Notes, sometimes I think I am getting even more confused.
From what I could understand, 99,9% of the examples I found develop the projects considering the HID class, as there are plenty of usb-ready device libraries with simple functions to be used. Also, there is no need to develop custom host-side drivers, as any OS already has HID drivers. So, people just build some blinking led project on top of this HID class, using some very simple functions, such as HID_Enable, etc...
However, if I need to develop some device hardware that is not classified as HID, how do I start? Is there any kind of USB device library to use, or do I need to write every single function from scratch?
Can I use Mikroelektronika's USB library to write firmware for non-HID devices?
Thank you all in advance.
- dejan.odabasic
- mikroElektronika team
- Posts: 2649
- Joined: 30 Apr 2012 14:20
Re: CDC Class added to USB Device Library!
Hello,
Please take a look at my answer to your question on your topic:
http://www.mikroe.com/forum/viewtopic.p ... 27#p215327
Best regards.
Please take a look at my answer to your question on your topic:
http://www.mikroe.com/forum/viewtopic.p ... 27#p215327
Best regards.
Re: CDC Class added to USB Device Library!
Hello, exist driver CDC for linux???????
- dejan.odabasic
- mikroElektronika team
- Posts: 2649
- Joined: 30 Apr 2012 14:20
Re: CDC Class added to USB Device Library!
Hello,
Linux doesn't require additional CDC drivers, it should already have support for CDC USB devices.
Best regards.
Linux doesn't require additional CDC drivers, it should already have support for CDC USB devices.
Best regards.
Re: CDC Class added to USB Device Library!
For Avr pascal ?
- dejan.odabasic
- mikroElektronika team
- Posts: 2649
- Joined: 30 Apr 2012 14:20
Re: CDC Class added to USB Device Library!
Hello,
We have in our plans development of USB support for AVR(including CDC class), but currently I cannot specify any date.
Thank you for understanding.
Best regards.
We have in our plans development of USB support for AVR(including CDC class), but currently I cannot specify any date.
Thank you for understanding.
Best regards.
Re: CDC Class added to USB Device Library!
I have to connect a GPS on a PIC18F4550 using the CDC class. Is there any possibility to use this microcontroller as master?