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 08:02:34 -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 09KEtjde006467; Tue, 20 Oct 2020 10:55:49 -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 09KEtiQv006447 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 20 Oct 2020 10:55:44 -0400 Received: from w92exedge4.exchange.mit.edu (W92EXEDGE4.EXCHANGE.MIT.EDU [18.7.73.16]) by outgoing-exchange-1.mit.edu (8.14.7/8.12.4) with ESMTP id 09KEtKBv012138 for ; Tue, 20 Oct 2020 10:55:44 -0400 Received: from oc11expo16.exchange.mit.edu (18.9.4.47) by w92exedge4.exchange.mit.edu (18.7.73.16) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Tue, 20 Oct 2020 10:55:18 -0400 Received: from oc11exhyb7.exchange.mit.edu (18.9.1.112) by oc11expo16.exchange.mit.edu (18.9.4.47) with Microsoft SMTP Server (TLS) id 15.0.1365.1; Tue, 20 Oct 2020 10:55:30 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.175) by oc11exhyb7.exchange.mit.edu (18.9.1.112) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 20 Oct 2020 10:55:30 -0400 Received: from CO2PR05CA0056.namprd05.prod.outlook.com (2603:10b6:102:2::24) by SN6PR0102MB3536.prod.exchangelabs.com (2603:10b6:805:10::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Tue, 20 Oct 2020 14:55:27 +0000 Received: from CO1NAM03FT058.eop-NAM03.prod.protection.outlook.com (2603:10b6:102:2:cafe::77) by CO2PR05CA0056.outlook.office365.com (2603:10b6:102:2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.13 via Frontend Transport; Tue, 20 Oct 2020 14:55:27 +0000 Received: from mail-io1-f42.google.com (209.85.166.42) by CO1NAM03FT058.mail.protection.outlook.com (10.152.81.107) 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 14:55:26 +0000 Received: by mail-io1-f42.google.com with SMTP id z5so3803724iob.1 for ; Tue, 20 Oct 2020 07:55:26 -0700 (PDT) From: David VanHorn To: Microcontroller discussion list - Public. Sender: "piclist-bounces@mit.edu" Date: Tue, 20 Oct 2020 07:55:13 -0700 Subject: Re: [PIC] Crystal frequency selection Thread-Topic: [PIC] Crystal frequency selection Thread-Index: Adam8gsiLEVMX3XQQq2PEjBJaGWI3Q== Message-ID: References: <5F8EF750.1010301@narwani.org> List-Help: List-Subscribe: , List-Unsubscribe: , In-Reply-To: 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: Pass X-MS-Exchange-Organization-PRD: mit.edu X-MS-TNEF-Correlator: received-spf: Pass (protection.outlook.com: domain of gmail.com designates 209.85.166.42 as permitted sender) receiver=protection.outlook.com; client-ip=209.85.166.42; helo=mail-io1-f42.google.com; dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=1/P3E+Dl0D95ZA9qJYK4s2pVhqbc3FUaPc8HcyfjX5A=; b=oCYQiuNRxX7cyIRemxqPeNSX8aLTHoWf3ToCf4W7iKq7KnVwWoXVX4jwd6kO7gMBp9 mPzrDXYk1BiAiRH1mybQzeY64qzzsGLIuZTzg7kWPpgKX+km7fSxAXyP5n8PbTpwM0+G F9wEzmUy2whq2n9gema26QKMWaGX+6WzclNIz+hUUO2oI64J91QC4eEsZ7b3LbbZGGcC QuWZ06ltmmF8kl7OII+WsmRagjDF9H5M21q+WL8LI8N/K5nGIxg5tUujHzDWFvdY8n52 kqxQuNsdqyCYMobf/Yqcz2kqF1DGOECB01mqNn7C5AA6E8eZi4ZzQm80L+yLI7YbHDHk CvCA== authentication-results: spf=pass (sender IP is 209.85.166.42) smtp.mailfrom=gmail.com; mit.edu; dkim=pass (signature was verified) header.d=gmail.com; mit.edu; dmarc=pass action=none header.from=gmail.com; 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-received: by 2002:a6b:1646:: with SMTP id 67mr2399368iow.189.1603205724903; Tue, 20 Oct 2020 07:55:24 -0700 (PDT) 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 58.982400 is as close as you'll get to 64 MHz and still divide evenly. You have 10 bits, and 5% error would be marginal, so I would shoot for >1% error so as to give the other system more than half of the error budget. An obscure little bug these days was in the Atmel Mega128 which had it's low power mode as the default. Without exactly the right crystal (very low CL value) the oscillator amplitude would be low, and parts of the chip would sometimes not get clocked. (!) This led to baud rates being a little slow and some non-deterministic execution, but it would occur so infrequently that you would more think it was a bug. The issue was uncovered for us when another batch of chips simply wouldn't start the crystal osc at all. Setting the chip to high power crystal cured all ills. I know a number of M128 users hit this problem. On Tue, Oct 20, 2020 at 8:50 AM 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 start > 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 >> > --=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 .