Hi Vsurducan,

Did you fix this issue? So far I never had issues with the USB driver but I had 
always used it with a crystal. Why are you using udc_cdc_putc()?

About your other post about the USB driver. I saw that you used a delay of 400 
ms in your main program. This may not work since the USB driver needs to be 
polled by usb_serial_flush() and this needs to be done quite frequently (I 
thought miliseconds).

I already found this polling a bit anoying myself since it would be nicer to 
have it done on an interrupt basis. Some time ago I started to make it 
interrupt driven but it did not work immediately at that time. Maybe it is a 
good time to pick it up again.

Kind regards,

Rob



________________________________
Van: [email protected] <[email protected]> namens vsurducan 
<[email protected]>
Verzonden: woensdag 24 februari 2021 20:33
Aan: [email protected] <[email protected]>
Onderwerp: Re: [jallib] WIN32CDCDrivers?

Thank you Matt and Rob,
I have a non reliable USB communication under both Win10 and Win7 so I'm 
suspecting everything...
The following sample is based on 18F4550_USB_serial.jal. PIC18F25K50 has the 
same registers as PIC18F2550 except some PLL bits which can be ignored with a 
delay.
However, USB works only with the echo. Trying to repeatedly send a byte from 
PIC to PC, communication it froze.

include 18f25k50                     -- target PICmicro
--
-- This program assumes that a 16 MHz resonator or crystal
-- is connected to pins OSC1 and OSC2.
pragma target clock 48_000_000      -- oscillator frequency
--

pragma target OSC      HSH                       -- crystal or resonator
pragma target PLLSEL   PLL3X
pragma target PLLEN    ENABLED                   -- PLL on
pragma target CPUDIV   P1                        -- Fosc divisor
pragma target WDT      DISABLED                  -- watchdog
pragma target XINST    DISABLED                  -- do not use extended 
instructionset
pragma target DEBUG    DISABLED                  -- no debugging
pragma target BROWNOUT DISABLED                  -- no brownout reset
pragma target FCMEN    DISABLED                  -- no clock monitoring
pragma target IESO     DISABLED                  -- no int/ext osc switching
pragma target LVP      DISABLED                   -- low voltage programming
pragma target MCLR     EXTERNAL                  -- external reset
--
-- The configuration bit settings above are only a selection, sufficient
-- for this program. Other programs may need more or different settings.
--
OSCCON_SCS = 0                      -- select primary oscillator
--
enable_digital_io()                 -- make all pins digital I/O
WDTCON_SWDTEN = OFF                     -- disable watchdog

include delay
include usb_serial
include print

-- constants
const  byte str_welcome[] = "JALLIB USB Serial Demo app\n"

-- variables

-- interrupts? No thanks
INTCON_GIE = false

-- setup the USB serial library
usb_serial_init()

var bit has_shown_welcome_msg = true
var byte ch

-- main loop
forever loop
-- poll the usb ISR function on a regular base, in order to
-- serve the USB requests
usb_serial_flush()

    -- check if USB device has been configured by the HOST
if ( usb_cdc_line_status() !=  0x00 )  then
if !has_shown_welcome_msg then
has_shown_welcome_msg = true
print_string( usb_serial_data, str_welcome )
end if
else
has_shown_welcome_msg = false
end if

-- check for input character ; this works
 if usb_serial_read( ch ) then
-- echo input character
    usb_serial_data = ch
 end if
; none of the following works, the USB is frozen...
;    usb_cdc_putc ("B")
;    format_word_dec(usb_serial_data, 0x3FC , 4, 0)
;    print_byte_dec(usb_serial_data, 0x04)



On Wed, Feb 24, 2021 at 9:02 PM Matt Schinkel 
<[email protected]<mailto:[email protected]>> wrote:
Hi, it is in jallib under tools/usb

Sent from my Android device.

________________________________
From: [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>> on behalf of Rob CJ 
<[email protected]<mailto:[email protected]>>
Sent: Wednesday, February 24, 2021 1:41:57 PM
To: [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>>
Subject: Re: [jallib] WIN32CDCDrivers?

 Hi Vsurducan,

I do not know but I think you do not need them. When I updated the serial 
library some time ago I could test it with a JAL sample program. Windows 10 
recognized the usb device without the need for driver.

If you use an older version of Windows I do not know if this is also true.

Kind regards,

Rob

________________________________
Van: [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>> namens vsurducan 
<[email protected]<mailto:[email protected]>>
Verzonden: woensdag 24 februari 2021 19:17
Aan: [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>>
Onderwerp: [jallib] WIN32CDCDrivers?

Hi, where can I find a copy of  the Win32CDCDrivers.zip ?
The links posted in the usb_serial_demo are broken.
thanks,

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/CAM%2Bj4quYAsdKiqVSCM%2BV6%2BaPFLvyeGj5WWfCgGnETB-e%2BW8wwQ%40mail.gmail.com<https://groups.google.com/d/msgid/jallib/CAM%2Bj4quYAsdKiqVSCM%2BV6%2BaPFLvyeGj5WWfCgGnETB-e%2BW8wwQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/AM0PR07MB6241E6D8D505B288C9B322B1E69F9%40AM0PR07MB6241.eurprd07.prod.outlook.com<https://groups.google.com/d/msgid/jallib/AM0PR07MB6241E6D8D505B288C9B322B1E69F9%40AM0PR07MB6241.eurprd07.prod.outlook.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/YQXPR01MB41496334B29E540ECA2A9766DE9F9%40YQXPR01MB4149.CANPRD01.PROD.OUTLOOK.COM<https://groups.google.com/d/msgid/jallib/YQXPR01MB41496334B29E540ECA2A9766DE9F9%40YQXPR01MB4149.CANPRD01.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/CAM%2Bj4qtwEeyURARHT7%3Dc2%2BqE-w7AtFX0Hmyg%2ByJAOL7q%3DGCEAQ%40mail.gmail.com<https://groups.google.com/d/msgid/jallib/CAM%2Bj4qtwEeyURARHT7%3Dc2%2BqE-w7AtFX0Hmyg%2ByJAOL7q%3DGCEAQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/AM0PR07MB6241C7A557FE8743121FB378E69C9%40AM0PR07MB6241.eurprd07.prod.outlook.com.

Reply via email to