Received: from PCH.mit.edu (18.7.21.50) by mail.efplus.com (192.168.0.8) with Microsoft SMTP Server (TLS) id 8.3.485.1; Tue, 20 Oct 2020 10:53:14 -0700 Received: from PCH.MIT.EDU (localhost.localdomain [127.0.0.1]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 09KHkghc004676; Tue, 20 Oct 2020 13:46:59 -0400 Received: from outgoing-exchange-1.mit.edu (OUTGOING-EXCHANGE-1.MIT.EDU [18.9.28.15]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 09KHkfMf004670 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 20 Oct 2020 13:46:41 -0400 Received: from oc11exedge2.exchange.mit.edu (OC11EXEDGE2.EXCHANGE.MIT.EDU [18.9.3.18]) by outgoing-exchange-1.mit.edu (8.14.7/8.12.4) with ESMTP id 09KHkQU3022370 for ; Tue, 20 Oct 2020 13:46:41 -0400 Received: from w92exhyb2.exchange.mit.edu (18.7.71.32) by oc11exedge2.exchange.mit.edu (18.9.3.18) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Tue, 20 Oct 2020 13:46:17 -0400 Received: from oc11exhyb8.exchange.mit.edu (18.9.1.113) by w92exhyb2.exchange.mit.edu (18.7.71.32) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 20 Oct 2020 13:46:23 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.36.58) by oc11exhyb8.exchange.mit.edu (18.9.1.113) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 20 Oct 2020 13:46:22 -0400 Received: from MWHPR14CA0015.namprd14.prod.outlook.com (2603:10b6:300:ae::25) by DM6PR01MB5545.prod.exchangelabs.com (2603:10b6:5:17c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21; Tue, 20 Oct 2020 17:46:17 +0000 Received: from CO1NAM03FT007.eop-NAM03.prod.protection.outlook.com (2603:10b6:300:ae:cafe::eb) by MWHPR14CA0015.outlook.office365.com (2603:10b6:300:ae::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Tue, 20 Oct 2020 17:46:17 +0000 Received: from premium47-1.web-hosting.com (68.65.123.241) by CO1NAM03FT007.mail.protection.outlook.com (10.152.80.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Tue, 20 Oct 2020 17:46:15 +0000 Received: from 107-145-246-199.res.spectrum.com ([107.145.246.199]:57713 helo=[192.168.10.107]) by premium47.web-hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1kUvi2-003z5O-9q; Tue, 20 Oct 2020 13:46:14 -0400 From: Neil To: Microcontroller discussion list - Public. Sender: "piclist-bounces@mit.edu" Date: Tue, 20 Oct 2020 10:46:05 -0700 Subject: Re: [PIC] Crystal frequency selection Thread-Topic: [PIC] Crystal frequency selection Thread-Index: AdanCeJbq06UkcvcThKbufg2stxXfA== Message-ID: <5F8F225D.5000307@narwani.org> References: <39957e6a-092a-4cdd-91b8-343db8741d06@DM3NAM03FT042.eop-NAM03.prod.protection.outlook.com> List-Help: List-Subscribe: , List-Unsubscribe: , In-Reply-To: <39957e6a-092a-4cdd-91b8-343db8741d06@DM3NAM03FT042.eop-NAM03.prod.protection.outlook.com> Reply-To: Microcontroller discussion list - Public. Accept-Language: en-US X-MS-Exchange-Organization-AuthAs: Anonymous X-MS-Exchange-Organization-AuthSource: TS500.efplus4.local X-MS-Has-Attach: X-Auto-Response-Suppress: All X-MS-Exchange-Organization-SenderIdResult: TempError X-MS-Exchange-Organization-PRD: mit.edu X-MS-TNEF-Correlator: received-spf: None (protection.outlook.com: narwani.org does not designate permitted sender hosts) dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=narwani.org ; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:Reply-To:To:References:Subject:Sender:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=slegf83vUh/s5twXOUeLmX6sA9DpxW6qw/W4W3WbYyY=; b=FobkXa9M0whKawG27nNPNgi+QY Ktax0QLnA++mcU6ARfJ0w8qTfW7b4vAZAnJV1hhRODhbkCsJGsII9lTcvna54xPzfVzuFVtLBFtb0 ABJKmZyDqyYwhZ1P3yVB2cNXpgUgdqdqD/8D7IPnuX9OVxU5EDmEc1twusTZZ9yQlUgqIB/mnBa4W IFf9JCuls5/M4J44JNIxYZB8x02JH3rstsGmMS5f5JIImHAFORGxsxVdBoHZIz6Fg6WGpDQRbQeNv Nr4huTS9z2MJYHaGsU0dPKriAI/7bnp4AMoTt2vPbtfNAhR9/AfX1Po3DMGjPQC/Aa9+rfXaReAyn ULVxGquQ==; authentication-results: spf=none (sender IP is 68.65.123.241) smtp.mailfrom=narwani.org; mit.edu; dkim=pass (signature was verified) header.d=narwani.org;mit.edu; dmarc=bestguesspass action=none header.from=narwani.org; user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 errors-to: piclist-bounces@mit.edu list-id: "Microcontroller discussion list - Public." list-post: x-beenthere: piclist@mit.edu x-mailman-version: 2.1.6 x-source-args: x-source-dir: x-antiabuse: Sender Address Domain - narwani.org x-source: x-authenticated-sender: premium47.web-hosting.com: ca4@narwani.org x-topics: [PIC] x-mime-autoconverted: from quoted-printable to 8bit by PCH.mit.edu id 09KHkfMf004670 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 As I mentioned at the opening, it was academic. On 10/20/2020 1:29 PM, WA1RHP_Android wrote: > The real question is: why do you need an exact baud rate?Sent from my Ver= izon, Samsung Galaxy smartphone > -------- Original message --------From: Neil Date:= 10/20/20 12:16 PM (GMT-05:00) To: piclist@mit.edu Subject: Re: [PIC] Cry= stal frequency selection I'm using datasheet 40001996D for the PIC18F45Q10.= The table of baud rate formulas on page 515 continued into page 516, so I= missed the option with SYNC=3D1 and BRGH=3D1. But same as the K22 part. = And yes I get the 0.08% error now.But still, shouldn't some easily availabl= e crystal value work out to 0% error?Cheers,-Neil.On 10/20/2020 11:40 AM, J= ohn Lawton wrote:> From the datasheet DS41412F page 383:>> SYNC =3D 0 BRG= H =3D 1, or SYNC =3D 1, BRG16 =3D 1>> Actual speed =3D 115.11k, error -0.08= % SPBRGHx: SPBRGx (decimal) =3D 138>> I should have said Fosc, (not clock s= peed) =3D 64MHz.>> J>> On 20/10/2020 16:18, David VanHorn wrote:>> What div= isor? I get 555.55...>>>> On Tue, Oct 20, 2020, 9:11 AM John Lawton wrote:>>>>> Which device?>>>>>> For the 18F25K22, -0.08% erro= r at 64MHz clock according to th! e datasheet.>>>>>> John>>>>>> On 20/10/2020 15:50, David VanHorn wrote:>>>= > 115200 might be tough since the divisor is getting small.>>>> 7.372800 wo= uld work, 14.745600, and so on.>>>>>>>>>>>> One thing a lot of people miss,= which causes baud rates to be off, is>>>> selecting the right crystal caps= ..>>>> A crystal with CL of 22pF wants (2*CL-Cp) =3D 44pF - Cp where Cp is a= n>>>> estimate of the parasitics (5 to 6 pf is a good first guess)>>>> Runn= ing 22pF caps puts you a bit high, and the oscillator might not start>>>> i= n all conditions.>>>>>>>>>>>>>>>> On Tue, Oct 20, 2020 at 8:44 AM Neil wrote:>>>>>>>>> A bit academic, but this is bugging me..= .. I was trying to get as close>>>>> to 115,200 baud on a PIC18F running at = 64Mhz (or thereabouts).>>>>> At 64Mhz, best I can get is 0.8% error using S= PBRG=3D34.>>>>> Calculating backwards, to get exactly 115,200, I can't find= an "exact">>>>> crystal.>>>>> Shouldn't I be able to find one of those "od= d" values to get e! xactly>>>>> 115,200 baud at around 64Mhz?>>>>>>>>>> Cheers,>>>>> -Neil.>>>= >>>>>>> -->>>>> http://www.piclist.com/techref/piclist PIC/SX FAQ & list ar= chive>>>>> View/change your membership options at>>>>> http://mailman.mit.e= du/mailman/listinfo/piclist>>>>>>>> -->>> http://www.piclist.com/techref/pi= clist PIC/SX FAQ & list archive>>> View/change your membership options at>>= > http://mailman.mit.edu/mailman/listinfo/piclist>>>-- http://www.piclist.c= om/techref/piclist PIC/SX FAQ & list archiveView/change your membership opt= ions athttp://mailman.mit.edu/mailman/listinfo/piclist --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .