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 09:09:17 -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 09KFxcRW018074; Tue, 20 Oct 2020 11:59:50 -0400 Received: from outgoing-exchange-7.mit.edu (OUTGOING-EXCHANGE-7.MIT.EDU [18.9.28.58]) by PCH.mit.edu (8.14.7/8.12.8) with ESMTP id 09KFxbv0018070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 20 Oct 2020 11:59:37 -0400 Received: from oc11exedge2.exchange.mit.edu (OC11EXEDGE2.EXCHANGE.MIT.EDU [18.9.3.18]) by outgoing-exchange-7.mit.edu (8.14.7/8.12.4) with ESMTP id 09KFxApX011940 for ; Tue, 20 Oct 2020 11:59:36 -0400 Received: from oc11exhyb4.exchange.mit.edu (18.9.1.100) by oc11exedge2.exchange.mit.edu (18.9.3.18) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Tue, 20 Oct 2020 11:59:02 -0400 Received: from oc11exhyb5.exchange.mit.edu (18.9.1.110) by oc11exhyb4.exchange.mit.edu (18.9.1.100) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 20 Oct 2020 11:59:07 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.102) by oc11exhyb5.exchange.mit.edu (18.9.1.110) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 20 Oct 2020 11:59:07 -0400 Received: from DM6PR01CA0015.prod.exchangelabs.com (2603:10b6:5:296::20) by SA0PR01MB6233.prod.exchangelabs.com (2603:10b6:806:e6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.25; Tue, 20 Oct 2020 15:59:06 +0000 Received: from DM3NAM03FT018.eop-NAM03.prod.protection.outlook.com (2603:10b6:5:296:cafe::71) by DM6PR01CA0015.outlook.office365.com (2603:10b6:5:296::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.23 via Frontend Transport; Tue, 20 Oct 2020 15:59:06 +0000 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (40.107.102.90) by DM3NAM03FT018.mail.protection.outlook.com (10.152.82.200) 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 15:59:05 +0000 Received: from CY4PR01MB2407.prod.exchangelabs.com (2603:10b6:903:6d::17) by CY4PR0101MB3077.prod.exchangelabs.com (2603:10b6:910:48::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.27; Tue, 20 Oct 2020 15:59:04 +0000 Received: from CY4PR01MB2407.prod.exchangelabs.com ([fe80::4477:5623:4c4f:2cf1]) by CY4PR01MB2407.prod.exchangelabs.com ([fe80::4477:5623:4c4f:2cf1%11]) with mapi id 15.20.3477.028; Tue, 20 Oct 2020 15:59:04 +0000 From: David Van Horn To: Microcontroller discussion list - Public. Sender: "piclist-bounces@mit.edu" Date: Tue, 20 Oct 2020 08:59:04 -0700 Subject: Re: [PIC] Crystal frequency selection Thread-Topic: [PIC] Crystal frequency selection Thread-Index: AQHWpu+Cye8XO8+oKEK1+gz9gEeJfamgksoAgAAFswCAAAInAIAABg4AgAAFOBs= Message-ID: References: <5F8EF750.1010301@narwani.org> <48194d83-b7bd-e7ce-bea1-7da72b0d6dbb@jle.co.uk> , <7c8a8645-4eea-455e-23e7-974dc429c5af@jle.co.uk> List-Help: List-Subscribe: , List-Unsubscribe: , In-Reply-To: <7c8a8645-4eea-455e-23e7-974dc429c5af@jle.co.uk> Reply-To: Microcontroller discussion list - Public. Accept-Language: en-US Content-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: Pass X-MS-Exchange-Organization-PRD: mit.edu X-MS-TNEF-Correlator: acceptlanguage: en-US received-spf: Pass (protection.outlook.com: domain of backcountryaccess.com designates 40.107.102.90 as permitted sender) receiver=protection.outlook.com; client-ip=40.107.102.90; helo=NAM04-DM6-obe.outbound.protection.outlook.com; dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=k2mdv.onmicrosoft.com; s=selector2-k2mdv-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BuAx35sNWXXsb4X70guseKlSKMBhDkPhtO/0xjwKhTc=; b=YxF244ln8QclF6BCt77ssUeno6tnaNWFJkqTpAl1byz4/XJrxVL+RVKOLALc8UOIHqDXBXneMq0Cn87Jpf9eemn9VsAGBSDRhnhvRSxiEG3mcFfFzL0Ef5wf+EhCucp195BQoELVuzigxrAtkuc5yxGByfwlNFSZALdmx2ZujGU= authentication-results: spf=pass (sender IP is 40.107.102.90) smtp.mailfrom=backcountryaccess.com; mit.edu; dkim=pass (signature was verified) header.d=k2mdv.onmicrosoft.com; mit.edu; dmarc=pass action=none header.from=backcountryaccess.com; x-originating-ip: [67.172.157.116] 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-topics: [PIC] x-content-filtered-by: Mailman/MimeDel 2.1.6 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Well that's certainly close enough. ________________________________ From: piclist-bounces@mit.edu on behalf of John L= awton Sent: Tuesday, October 20, 2020 9:40 AM To: piclist@mit.edu Subject: Re: [PIC] Crystal frequency selection >From the datasheet DS41412F page 383: SYNC =3D 0 BRGH =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 speed) =3D 64MHz. J On 20/10/2020 16:18, David VanHorn wrote: > What divisor? I get 555.55... > > On Tue, Oct 20, 2020, 9:11 AM John Lawton wrote: > >> Which device? >> >> For the 18F25K22, -0.08% error at 64MHz clock according to the datasheet= .. >> >> John >> >> On 20/10/2020 15:50, David VanHorn wrote: >>> 115200 might be tough since the divisor is getting small. >>> 7.372800 would 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 an >>> estimate of the parasitics (5 to 6 pf is a good first guess) >>> Running 22pF caps puts you a bit high, and the oscillator might not sta= rt >>> in 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 SPBRG=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 "odd" values to get exactly >>>> 115,200 baud at around 64Mhz? >>>> >>>> Cheers, >>>> -Neil. >>>> >>>> -- >>>> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive >>>> View/change your membership options at >>>> http://mailman.mit.edu/mailman/listinfo/piclist >>>> >> -- >> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> -- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://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 .