Update on USB to Serial TLL project (V2)

47 views
Skip to first unread message

rob...@hotmail.com

unread,
Oct 23, 2021, 10:34:14 AM10/23/21
to jallist
Hi all,

This is just for your information in case you need a serial TTL connection from your PIC to your computer using a USB connection as COM port.

In 2020 I posted a JAL project called USB to Serial TTL on Instructables. It was not a super flexible solution since the serial baudrate of the PIC could only be configured via jumpers and the number of different baudrates was limited.

Last week I implemented a small fix in the JAL USB driver that prevented data loss for a certain type of PIC. For that I had to study the USB driver in more detail and found out how I can use the serial settings done from USB side to use them for serial settings on the PIC.

So I posted an update of this project on Instructables: USB to Serial TTL V2 : 3 Steps - Instructables

The baudrate range is now from 110 baud to 230400 baud. 

Kind regards,

Rob



Lulu

unread,
Nov 15, 2021, 12:46:32 PM11/15/21
to jallist

Hello, thanks you very much to share this project. I'm a newby in pic/usb and this is very usefull for me !
Is it possible to save the 12Mhz quartz and use the internal oscillator of the PIC instead ?



Rob CJ

unread,
Nov 15, 2021, 12:51:39 PM11/15/21
to jal...@googlegroups.com
Hi Lulu,

Yes. If you look at the following settings you could replace the top 3 target setting mentioned for the 12 MHz clock by th 3 settings below (now commented out) that used for the internal clock. It will then work without a crystal.

Kind regards,

Rob



pragma target clock       48_000_000

-- Settings for external 12 MHz crystal and system clock 48 MHz.
pragma target OSC           HS       -- External crystal
pragma target CLKOUTEN      ENABLED  -- CLKOUT function is enabled
pragma target PLLMULT       N4X      -- PLL Multipler Selection Bit, 4x Output Frequency Selected

-- Settings for internal clock and system clock 48 MHz.
-- pragma target OSC           INTOSC_NOCLKOUT -- Internal clock
-- pragma target CLKOUTEN      DISABLED -- CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin
-- pragma target PLLMULT       N3X      -- PLL Multipler Selection Bit, 3x Output Frequency Selected

-- Other fuses
pragma target CPUDIV        P1       -- NO CPU system divide
pragma target USBLSCLK      F48MHZ   -- System clock expects 48 MHz, FS/LS USB CLKENs divide-by is set to 8.
pragma target PLLEN         ENABLED  -- 3x or 4x PLL Enabled
pragma target FCMEN         DISABLED -- Fail-Safe Clock Monitor is disabled
pragma target WRT           DISABLED -- Write protection off
pragma target STVR          ENABLED  -- Stack Overflow or Underflow will cause a Reset
pragma target LPBOR         DISABLED -- Low-Power BOR is disabled
pragma target IESO          DISABLED -- Internal/External Switchover Mode is disabled
pragma target PWRTE         DISABLED -- power up timer
pragma target BROWNOUT      DISABLED -- no brownout detection
pragma target WDT           DISABLED -- Watchdog disabled
pragma target MCLR          EXTERNAL -- External reset
pragma target LVP           ENABLED  -- allow low-voltage programming
pragma target VOLTAGE       MAXIMUM  -- brown out voltage
pragma target CP            DISABLED -- Program memory code protection is disabled

OSCCON        = 0b1111_1100          -- Select PLL,3x, 16MHz internal oscillator


Van: jal...@googlegroups.com <jal...@googlegroups.com> namens Lulu <specta...@gmail.com>
Verzonden: maandag 15 november 2021 13:29
Aan: jallist <jal...@googlegroups.com>
Onderwerp: [jallist] Re: Update on USB to Serial TLL project (V2)
 

Hello, thanks you very much to share this project. I'm a newby in pic/usb and this is very usefull for me !
Is it possible to save the 12Mhz quartz and use the internal oscillator of the PIC instead ?



--
You received this message because you are subscribed to the Google Groups "jallist" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallist+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallist/24045694-a2fb-4345-a859-1ffe04b19bebn%40googlegroups.com.

Lulu

unread,
Nov 16, 2021, 12:36:47 PM11/16/21
to jallist
Oh sorry ! I did not see the 3 lines to configure the internal oscillator. You had already planned everything!
So, why do you use an external crystal ? Is there any particular reason for this ? It's just for curiosity.

Rob CJ

unread,
Nov 16, 2021, 12:39:36 PM11/16/21
to jal...@googlegroups.com
Hi Lulu,

I think that in the end it is was not really required since the internal oscillator should be sufficient. There is no real critical timing for that application. The only thing that requires a certain timing is the serial interface but timing is not that strict unless you would use very high baudrates.

So next time I will leave the crystal out 🙂

Kind regards,

Rob


Verzonden: maandag 15 november 2021 20:08
Aan: jallist <jal...@googlegroups.com>
Onderwerp: Re: [jallist] Re: Update on USB to Serial TLL project (V2)
 

Lulu

unread,
Nov 16, 2021, 2:53:53 PM11/16/21
to jallist
Hi Rob, so I will use the version without crystal.
Thanks you very much for yours answers and to share your knowledge on PIC mcu and  your work on JAL. JAL is awesome !
Sincerely

Rob CJ

unread,
Nov 17, 2021, 1:19:09 PM11/17/21
to jal...@googlegroups.com
Hi Lulu,

Thanks. I am a bit curious about the following. How did you get to know JAL?

Would be good to know to stimulate any promotion activities 🙂.

Kind regards,

Rob


Verzonden: dinsdag 16 november 2021 20:53

Lulu

unread,
Nov 17, 2021, 2:33:36 PM11/17/21
to jallist
I will try, my english is not well...
I use PIC (8bits mcu only) since 5/6 years mainly to control some servomotors and lights (220V and low voltage) for purpose puppets show. My first attempt to do that was not running well, not enough precision for servo control, but I used it during 4 years. Then I searched on the net (Google) other means than mine to control servomotor with more precision and I found this link http://www.justanotherlanguage.org/content/jallib/tutorials/tutorial_servo_rc_master
I then uploaded Jal and tryed it. The way you used a timer to control 8 servomotors blew my mind! I would never have thought of it.
This is how I discovered JAL.

Regards

Rob CJ

unread,
Nov 18, 2021, 1:03:49 PM11/18/21
to jal...@googlegroups.com
Hi Lulu,

Good to hear and thanks for the info. Enjoy the JAL experience.

Kind regards,

Rob


Verzonden: woensdag 17 november 2021 20:33
Reply all
Reply to author
Forward
0 new messages