Hello,
I just started to test the USB and I saw that it refers to the version SFUSBv142.
I tried to compile main_hid_SFtest.bas on a 18F4458 and I will generate the error
"The ordinal Constant expression expected"
followed by 2 errors
"Identifier Not Declared: TXReportRAM"
and
"Identifier Not Declared: RXReportRAM."
The 18F4458 has the dual ram (1-Kbyte Dual Access RAM for USB).
Where am I doing wrong?
Is there any particular OPTION to set?
Thank you.
USB Problem
Moderators: David Barker, Jerry Messina
-
- Swordfish Developer
- Posts: 1470
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: USB Problem
Sorry... some of the definitions were changed after that example file was written.
TXReportRAM and RXReportRAM became TX_Report_RAM and RX_Report_RAM
Try using this instead...
TXReportRAM and RXReportRAM became TX_Report_RAM and RX_Report_RAM
Try using this instead...
Code: Select all
//
//-------------------------------------------------------------
// USB report structures
//-------------------------------------------------------------
//
// TX report...
structure TTXReport
Time as word
Message as string
end structure
dim TXReport as TTXReport absolute TX_Report_RAM
// RX report...
structure TRXReport
LED0 as bit
LED1 as bit
end structure
dim RXReport as TRXReport absolute RX_Report_RAM
Re: USB Problem
OK !
still a small request ..
I mounted a quartz 12MHz while the example is with a 24MHz quartz.
The device is found, the PC searches for the driver "HID Swordfish" but after installing it HID does not seem to respond correctly and becomes "Unknown device".
The configuration seems correct for 12MHz xtal ?
still a small request ..
I mounted a quartz 12MHz while the example is with a 24MHz quartz.
The device is found, the PC searches for the driver "HID Swordfish" but after installing it HID does not seem to respond correctly and becomes "Unknown device".
The configuration seems correct for 12MHz xtal ?
Code: Select all
Device = 18F4458 ' 2553
Clock = 48
Config
FOSC = HSPLL_HS,
' PLLDIV = 6,
PLLDIV = 3,
CPUDIV = OSC1_PLL2,
USBDIV = 2,
FCMEN = OFF,
IESO = OFF,
PWRT = ON,
BOR = OFF,
BORV = 2,
VREGEN = ON,
WDT = OFF,
WDTPS = 2048,
CCP2MX = OFF,
PBADEN = OFF,
LPT1OSC = OFF,
' MCLRE = ON,
MCLRE = OFF,
STVREN = ON,
LVP = OFF,
XINST = OFF,
DEBUG = OFF
-
- Swordfish Developer
- Posts: 1470
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
Re: USB Problem
That looks like the right setup for a 12MHz xtal
Re: USB Problem
Noise on Vcc dumped with extra 220nF capacitor and 220nF to 470nF capacitor on VUSB pin.
In some circuits there are 2 x 330 ohm resistors in series on D+ and D- lines for protection I think ..
I removed this resistors otherwise sometimes PC does not recognize the hardware.
ALL OK !
In some circuits there are 2 x 330 ohm resistors in series on D+ and D- lines for protection I think ..
I removed this resistors otherwise sometimes PC does not recognize the hardware.
ALL OK !