Hi Vasile,

Thanks for the update. I can add a sample for the PIC18F4550 to the new Jallib 
release.

@Hans. Can you send the version that works OK?

Thanks.

Kind regards,

Rob

________________________________
Van: jallib@googlegroups.com <jallib@googlegroups.com> namens vsurducan 
<vsurdu...@gmail.com>
Verzonden: zaterdag 17 december 2022 08:00
Aan: jallib@googlegroups.com <jallib@googlegroups.com>
Onderwerp: Re: [jallib] USB_help

It seems to me that flushing was the problem. It works with interrupts but jal 
1.7.0 seems to not have the usb serial interrupt sample for pic18f4550?

That delay is ok if you program the pic while is connected to usb. It tooks a 
while until pc see the pic, but that depends on pc, os, etc. If you send only 
once a text (as the sample is), there are big chances to not see it on pc.


On Fri 16 Dec 2022, 9:02 PM Rob CJ 
<rob...@hotmail.com<mailto:rob...@hotmail.com> wrote:
Hi Hans, Vasile,

What has been changed that it now works?

If I look at the setting for the chip I do not see a difference with the 
program that Hans had sent before.

I see in the program below a delay of 5 seconds but that will cause a problem.

There are two ways to use the USB library, without interrupt (which used to be 
the only way to use it) and with interrupt.

If you use it without interrupt you have to call the usb_serial_flush() routine 
regularly otherwise the USB wil stop working.

If you cannot serve this function regulary then you should use the library in 
the mode that is uses the interrupt which I see is being used in the last 
example.

If this 5 seconds delay was in the previous program then that may have caused 
the USB problem.

Kind regards,

Rob

________________________________
Van: jallib@googlegroups.com<mailto:jallib@googlegroups.com> 
<jallib@googlegroups.com<mailto:jallib@googlegroups.com>> namens hans 
<hanze...@zeelandnet.nl<mailto:hanze...@zeelandnet.nl>>
Verzonden: vrijdag 16 december 2022 18:52
Aan: jallib <jallib@googlegroups.com<mailto:jallib@googlegroups.com>>
Onderwerp: Re: [jallib] USB_help

Hello Vasile
I have always worked as you indicated. Program, unplug everything and then plug 
it back in. prompt response that the case was not recognized. See my previous 
message.
Now your latest version, does nothing at all. Loaded the previous version again 
and it works as stated before.
regards
Hans

Op vrijdag 16 december 2022 om 18:07:52 UTC+1 schreef vasile:
Hans,
I think you are doing in this way:
1. USB connection is kept permanently between your board and PC
2. your board is programmed with pickit and after programming you expect to see 
immediately the pic USB device in your PC
right?

After programming you have to disconnect your PC from USB and connect it again, 
wait a bit until the computer sees your device.
I think the original sample will work in this way, however below is the the 
sample (using interrupts) which should work without disconnecting your PIC from 
USB after programming ( please note I did not tested, no PIC18F4450 or PIC2550 
available now).

Finally you may comment the 5s delay if you wish, but you may loss the " JALLIB 
USB Serial Demo" string.
Hopefully will work for you.

-- ---------------------------------------
include 18f4550


-- even though the external crystal is 20 MHz, the configuration is such that
-- the CPU clock is derived from the 96 Mhz PLL clock (div2), therefore set
-- target frequency to 48 MHz
pragma target clock       48_000_000


-- fuses
pragma target PLLDIV        P5          -- divide by 5 - 20MHZ_INPUT
pragma target CPUDIV        P1          -- [primary oscillator src: /1][96 mhz 
pll src: /2]
pragma target USBDIV        P2          -- CLOCK_SRC_FROM_96MHZ_PLL_2
pragma target OSC           HS_PLL
pragma target FCMEN         DISABLED
pragma target IESO          DISABLED
pragma target PWRTE         DISABLED    -- power up timer
pragma target VREGEN        ENABLED     -- USB voltage regulator
pragma target VOLTAGE       V21         -- brown out voltage

pragma target BROWNOUT      DISABLED    -- no brownout detection
pragma target WDTPS         P32K        -- watch dog saler setting
pragma target WDT           CONTROL     -- watchdog software controlled
pragma target CCP2MUX       pin_C1      -- CCP2 on pin C1
pragma target PBADEN        DIGITAL     -- digital input port<0..4>
pragma target LPT1OSC       LOW_POWER   -- low power timer 1
pragma target MCLR          EXTERNAL    -- master reset on RE3
pragma target STVR          DISABLED    -- reset on stack over/under flow
pragma target LVP           ENABLED     -- allow low-voltage programming

pragma target XINST         DISABLED     -- extended instruction set
pragma target DEBUG         DISABLED    -- background debugging
pragma target CP0           DISABLED    -- code block 0 not protected
pragma target CP1           DISABLED    -- code block 1 not protected
pragma target CP2           DISABLED    -- code block 2 not protected
pragma target CP3           DISABLED    -- code block 3 not protected
pragma target CPB           DISABLED    -- bootblock code not write protected
pragma target CPD           DISABLED    -- eeprom code not write protected
pragma target WRT0          DISABLED    -- table writeblock 0 not protected
pragma target WRT1          DISABLED    -- table write block 1 not protected
pragma target WRT2          DISABLED    -- table write block 2 not protected
pragma target WRT3          DISABLED    -- table write block 3 not protected
pragma target WRTB          DISABLED    -- bootblock not write protected
pragma target WRTD          DISABLED    -- eeprom not write protected
pragma target WRTC          DISABLED    -- config not write protected
pragma target EBTR0         DISABLED    -- table read block 0 not protected
pragma target EBTR1         DISABLED    -- table read block 1 not protected
pragma target EBTR2         DISABLED    -- table read block 2 not protected
pragma target EBTR3         DISABLED    -- table read block 3 not protected
pragma target EBTRB         DISABLED    -- boot block not protected

WDTCON_SWDTEN = OFF                     -- disable watchdog

const USB_INTERRUPT_DRIVEN = TRUE
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

delay_1s (5)

-- main loop
forever loop

if !defined(USB_INTERRUPT_DRIVEN) then
      -- When the interrupt mode is not used we need to poll the usb ISR 
function
      -- on a regular base, in order to serve the USB requests otherwise
      -- this call can be removed.
      usb_serial_flush()
   end if

    -- 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
if usb_serial_read( ch ) then
-- echo input character
usb_serial_data = ch
end if

end loop
-- -------------------------------------------------------



On Fri, Dec 16, 2022 at 6:06 PM hans <hanz...@zeelandnet.nl> wrote:
Hi Vasile,
With this the connection is accepted. i see a new com port and on a terminal a 
bunch of values.
 I have to disconnect the Pickit.
Can you complete this with the example in the sample ?
great
Hans

Op vrijdag 16 december 2022 om 15:46:26 UTC+1 schreef vasile:
Hi Hans,
could you test the following code? Just change the include PIC18F2550 with 
PIC18F4550

-- -------------------------------------------------
include 18f2550

-- even though the external crystal is 20 MHz, the configuration is such that
-- the CPU clock is derived from the 96 Mhz PLL clock (div2), therefore set
-- target frequency to 48 MHz
pragma target clock       48_000_000


-- fuses
pragma target PLLDIV        P5          -- divide by 5 - 20MHZ_INPUT
pragma target CPUDIV        P1          -- [primary oscillator src: /1][96 mhz 
pll src: /2]
pragma target USBDIV        P2          -- CLOCK_SRC_FROM_96MHZ_PLL_2
pragma target OSC           HS_PLL
pragma target FCMEN         DISABLED
pragma target IESO          DISABLED
pragma target PWRTE         DISABLED    -- power up timer
pragma target VREGEN        ENABLED     -- USB voltage regulator
pragma target VOLTAGE       V43         -- brown out voltage
pragma target BROWNOUT      DISABLED    -- no brownout detection
pragma target WDTPS         P32K        -- watch dog saler setting
pragma target WDT           CONTROL     -- watchdog software controlled
pragma target CCP2MUX       pin_C1      -- CCP2 on pin C1
pragma target PBADEN        DIGITAL     -- digital input port<0..4>
pragma target LPT1OSC       LOW_POWER   -- low power timer 1
pragma target MCLR          EXTERNAL    -- master reset on RE3
pragma target STVR          DISABLED    -- reset on stack over/under flow
pragma target LVP           DISABLED     -- allow low-voltage programming
pragma target XINST         DISABLED     -- extended instruction set
pragma target DEBUG         DISABLED    -- background debugging
pragma target CP0           DISABLED    -- code block 0 not protected
pragma target CP1           DISABLED    -- code block 1 not protected
pragma target CP2           DISABLED    -- code block 2 not protected
pragma target CP3           DISABLED    -- code block 3 not protected
pragma target CPB           DISABLED    -- bootblock code not write protected
pragma target CPD           DISABLED    -- eeprom code not write protected
pragma target WRT0          DISABLED    -- table writeblock 0 not protected
pragma target WRT1          DISABLED    -- table write block 1 not protected
pragma target WRT2          DISABLED    -- table write block 2 not protected
pragma target WRT3          DISABLED    -- table write block 3 not protected
pragma target WRTB          DISABLED    -- bootblock not write protected
pragma target WRTD          DISABLED    -- eeprom not write protected
pragma target WRTC          DISABLED    -- config not write protected
pragma target EBTR0         DISABLED    -- table read block 0 not protected
pragma target EBTR1         DISABLED    -- table read block 1 not protected
pragma target EBTR2         DISABLED    -- table read block 2 not protected
pragma target EBTR3         DISABLED    -- table read block 3 not protected
pragma target EBTRB         DISABLED    -- boot block not protected

WDTCON_SWDTEN = OFF                     -- disable watchdog

const USB_INTERRUPT_DRIVEN = TRUE
include usb_serial
include print
include delay

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

-- setup the USB serial library
usb_serial_init()

-- variables
var bit has_shown_welcome_msg = true
var byte ch
var dword counter_dw  = 0xFFFF_FFFF
var byte counter_b = 0
var word timer = 0

delay_1s (5)

-- main loop
forever loop

   if !defined(USB_INTERRUPT_DRIVEN) then
      -- When the interrupt mode is not used we need to poll the usb ISR 
function
      -- on a regular base, in order to serve the USB requests otherwise
      -- this call can be removed.
      usb_serial_flush()
   end if



;           timer = timer + 1
;        if timer == 500 then
;           timer = 0

;           print_byte_dec (usb_serial_data, counter_b)
;           _usec_delay( 1 )
;           usb_serial_data = " "
           print_dword_dec( usb_serial_data, counter_dw )
;           _usec_delay( 1 )
           print_crlf(usb_serial_data)
;           counter_dw = counter_dw + 1
;           counter_b = counter_b + 1
;        end if
;           _usec_delay( 1 )

end loop

On Fri, Dec 16, 2022 at 3:20 PM hans <hanz...@zeelandnet.nl> wrote:
Hey ,
I have now received the 18F4550 and the 16F1455 and have tried both with the 
usb_serial samples. programming with PicKit_3, but in all cases I get a warning 
on my PC (both on win10 and win7) that the USB is not recognized. The Vusb with 
capacitor reads 3.3 volts and I have programmed both with and without LVP. 
identical to my previous attempts.
Apparently USB is not allowed to me
Hans

Op woensdag 14 december 2022 om 14:19:16 UTC+1 schreef zet....@gmail.com:

Hi Matt

I see your question 10-12 now: Wednesday 14-12

I am not at home for 2 days.

I can test. You hear as soon as possible.



Regards

Peter



Van: jal...@googlegroups.com [mailto:jal...@googlegroups.com] Namens Matthew 
Schinkel
Verzonden: zondag 11 december 2022 04:18
Aan: jallib <jal...@googlegroups.com>
Onderwerp: Re: [jallib] USB_help



Hi Hans, what chip is it working on?



Is anyone else able to test the 18f4455 blink usb sample?

On Saturday, December 10, 2022 at 1:18:39 PM UTC-5 hans wrote:

Hello, I tested the sample 18f4455 Blink_hs_usb.jal. This one didn't work. Then 
I restarted Bert van Dam's old business and tried the same program on it. that 
works as it should.!!!!
I have also tested ports D+ and D- (24 and 23) as inputs and those ports work 
as well. I now doubt whether the PIC is broken or something else is going on.
regards
Hans

Op zaterdag 10 december 2022 om 10:30:14 UTC+1 schreef hans:

Hello champs,
I have reassembled everything and I can only conclude that the PIC itself (has 
done some things before) is defective. Unfortunately, I no longer have a PIC 
with USB, so I put it back in the fridge. I will have to look for another one 
but the market is scarce.
Thanks again for your great responses.
regards
Hans

Op zaterdag 10 december 2022 om 06:18:17 UTC+1 schreef vasile:

Yep. Matt has right.

1.The clock speed is esential.

2. You will notice quite a long delay (5s or so) between plugging the pic usb 
and the moment when OS recognize it on pc. This depends by your computer speed 
and pic firmware contents. If pic clk is wrong, you will not see any usb 
device. After it appears, check on printer/pheripheral for your device but 
watch for any warnings there....

On Sat 10 Dec 2022, 4:59 AM Matthew Schinkel <mattsc...@hotmail.com wrote:

Also use the code in 18f455_blink_hs_usb.jal



You are missing this one:

OSCCON_SCS = 0                      -- select primary oscillator

On Friday, December 9, 2022 at 9:54:43 PM UTC-5 Matthew Schinkel wrote:

Hi Hans,



There must be an issue with your circuit. Do you have the correct clock speed? 
Make sure a blink sample and normal serial port is working. Try another PC. 
Windows should pick it up.



Matt.

On Friday, December 9, 2022 at 3:12:12 PM UTC-5 hans wrote:

Hello,
Thank you. I did what you recommended. Last Bee and tip from Vasile. Same 
message from windows, not recognized and causing a malfunction. Pffffff/
regards
Hans

Op vrijdag 9 december 2022 om 18:43:24 UTC+1 schreef rob...@hotmail.com:

Hi Hans,



As Vasile already mentioned Windows 10 will detect your device as a serial 
(COM) port without the need of installing a separate driver.



Make sure you have the USB connections right. The signals are not crossed like 
for USART, so D+ to D+ and D- to D-.



I attached a schematic diagram based on the PIC16F1455 for your information and 
the USB connectors and what the signals look like.



Good luck!



Kind regards,

Rob



________________________________

Van: jal...@googlegroups.com <jal...@googlegroups.com> namens vsurducan 
<vsur...@gmail.com>
Verzonden: vrijdag 9 december 2022 18:12
Aan: jal...@googlegroups.com <jal...@googlegroups.com>
Onderwerp: Re: [jallib] USB_help



Hi Hans,

for win10 you do not need any special driver, just a good terminal like 
Teraterm.

Download the last jal package, Rob did some modifications on USB driver,

my suggestion is to use const USB_INTERRUPT_DRIVEN = TRUE

The maximum speed is about 100kbps.







On Fri, Dec 9, 2022 at 5:42 PM hans <hanz...@zeelandnet.nl> wrote:

Hello,
I am trying to learn more about USB and have tried a sample program( ex 
18F2450)  (see attachment) I keep getting the remark that windows 10 does not 
recognize the connection and cannot install the driver. What am I doing wrong??
regards
Hans

--
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 jallib+un...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/c92e6cb2-a584-4b1b-a77f-d8bf943560b2n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/c92e6cb2-a584-4b1b-a77f-d8bf943560b2n%40googlegroups.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 jallib+un...@googlegroups.com.

To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/CAM%2Bj4quO70sp3CP%2BezE5_6jDU%2BpsJ2D7-MAU9bzRm1U1RbmACA%40mail.gmail.com<https://groups.google.com/d/msgid/jallib/CAM%2Bj4quO70sp3CP%2BezE5_6jDU%2BpsJ2D7-MAU9bzRm1U1RbmACA%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 jallib+un...@googlegroups.com.

To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/df1d95ac-2ed5-46e2-80c6-47021bf19395n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/df1d95ac-2ed5-46e2-80c6-47021bf19395n%40googlegroups.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 jallib+un...@googlegroups.com.

To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/1c3098ea-5a51-4e41-a148-9782036d4b34n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/1c3098ea-5a51-4e41-a148-9782036d4b34n%40googlegroups.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 jallib+un...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/4a8e384e-f796-4b51-b9ea-ab93e2336a96n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/4a8e384e-f796-4b51-b9ea-ab93e2336a96n%40googlegroups.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 jallib+un...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/4c0c588f-12b8-47cb-a9c3-e8f21dd63f9an%40googlegroups.com<https://groups.google.com/d/msgid/jallib/4c0c588f-12b8-47cb-a9c3-e8f21dd63f9an%40googlegroups.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 
jallib+unsubscr...@googlegroups.com<mailto:jallib+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/7ae2a91b-f74b-43f5-b14a-247a8d6afa20n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/7ae2a91b-f74b-43f5-b14a-247a8d6afa20n%40googlegroups.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 
jallib+unsubscr...@googlegroups.com<mailto:jallib+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/GVXP195MB1637C820F583293BA1E8D58AE6E69%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM<https://groups.google.com/d/msgid/jallib/GVXP195MB1637C820F583293BA1E8D58AE6E69%40GVXP195MB1637.EURP195.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 
jallib+unsubscr...@googlegroups.com<mailto:jallib+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/CAM%2Bj4qvs42vwf5kURjTKqZgpjdnakLP5HmTzce91CZxtzxfevw%40mail.gmail.com<https://groups.google.com/d/msgid/jallib/CAM%2Bj4qvs42vwf5kURjTKqZgpjdnakLP5HmTzce91CZxtzxfevw%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 jallib+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/GVXP195MB1637EFF6018B4E2AC13A7F55E6E79%40GVXP195MB1637.EURP195.PROD.OUTLOOK.COM.

Reply via email to