|
|
View previous topic :: View next topic |
Author |
Message |
maier
Joined: 03 Apr 2014 Posts: 2 Location: Deutschland
|
USB with PIC24EP512GU810 |
Posted: Tue Feb 19, 2019 9:31 am |
|
|
I'm trying to get this PIC USB to work. I copied the code and descriptor from a working project (other PIC), but it doesn't work (Error requesting the USB device descriptor, Code 43).
Code: |
#include <24EP512GU810.h>
#device ICSP=1
#use delay(osc=24MHZ, clock=48MHZ, USB)
#FUSES NOWDT //No Watch Dog Timer
#FUSES CKSFSM //Clock Switching is enabled
#FUSES BROWNOUT
#FUSES NOJTAG //JTAG disabled
#FUSES NODEBUG
#define EP1 1
#include <pic24_usb.h> //Microchip PIC18 hardware layer for usb.c
#include "usb_desc_hid.h" //USB Device descriptor
#include <usb.c>
#define SIZE 8
void main( void )
{
char inbuf[SIZE];
char outbuf[SIZE];
usb_init_cs();
while(TRUE) {
usb_task();
if(usb_enumerated()) {
if (usb_kbhit(EP1)) {
usb_get_packet(EP1,inbuf,SIZE);
if (inbuf[0]==10) {
outbuf[0]='o';
outbuf[1]='k';
outbuf[2]=0;
}
usb_puts(EP1, outbuf, SIZE, 100 );
}
}
}
}
|
Anybody recognize a mistake?
Or is there something special to consider with this PIC?
Is there a way to measure the oscillator? If you could get the PIC to output to USB with a few lines, you could use an oscilloscope to verify the frequency. This would certainly be a very helpful feature for many developers
Uli |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Tue Feb 19, 2019 10:13 am |
|
|
I don't use that PIC but...
this...
#include <pic24_usb.h> //Microchip PIC18 hardware layer for usb.c
seems 'wrong' ? Would the pic24 need a PIC 24 HW layer and not PIC18 HW layer ??
I gave up with embedded USB PICs years ago. It's simpler,easier, cheaper to just buy a TTL<>USB module. I've bought dozens over the years and all have worked without any problems.
Jay |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|