Re: Serial connection is garbled at 32MHz
Greg Ungerer <[email protected]> Thu, 10 Apr 2008 23:33:56 +1000
| Newsgroups | gmane.comp.hardware.motorola.microcontrollers.coldfire |
|---|---|
| Message-ID | <[email protected]> |
X-SpamDetect-Info: ------------- Start ASpam results --------------- X-SpamDetect-Info: This message may be spam. This message BODY has been altered to show you the spam information X-SpamDetect: *****: 5.100000 DodgySource=2.0, SPF Default Fail=2.5, X-Verify-SMTP present=0.6 X-SpamDetect-Info: ------------- End ASpam results ----------------- Hi Loren, Loren A. Linden Levy wrote: > So do I need to maybe change something in my minicom setup? I doubt it. Check with another serial device known to work at that baud rate. If you have access to a CRO then measure the character length output on the serial line and you will at least know what is actually being generated. Perhaps that clue will help. Regards Greg > On Mon, 07 Apr 2008 10:50:44 +1000 > Greg Ungerer <[email protected]> wrote: > >> Hi Loren, >> >> Loren A. Linden Levy wrote: >>> On Fri, 04 Apr 2008 11:06:59 +1000 >>> Greg Ungerer <[email protected]> wrote: >>>> Allon Stern wrote: >>>>> On Apr 3, 2008, at 2:20 PM, Loren A. Linden Levy wrote: >>>>>> So I am making progress with this external FPGA (thanks to all the >>>>>> help) and I have the code basically working (I think). One thing we >>>>>> are doing is artificially running the chip (M%282) at 32MHz and this >>>>>> screws up the display over serial (I get nonsense characters). This is >>>>>> not too big a deal b/c I can connect just fine over telnet I was just >>>>>> wondering if there was an obvious way to fix it (settings?). Thanks >>>>>> again. >>>>> I'd suggest looking at (assuming 2.6) linux2.6.x/drivers/serial/mcfserial.c >>>>> >>>>> Look for the line (#636 in my kernel): >>>>> /* compute the baudrate clock */ >>>>> >>>>> This is where it determines the baudrate clock based on the CPU clock. >>>>> >>>>> It appears to be based off of MCF_BUSCLK, which is defined in >>>>> linux2.6.x./include/asm-m68knommu/coldfire.h as >>>>> #define MCF_BUSCLK (CONFIG_CLOCK_FREQ / CONFIG_CLOCK_DIV) >>>>> >>>>> Both CONFIG_CLOCK_FREQ and CONFIG_CLOCK_DIV are defined in your .config. >>>> That is right. If you are just feeding a different master >>>> clock to the 5282 then the right change to make is to >>>> CONFIG_CLOCK_FREQ. Look for the config menu item with the >>>> text "Set the core clock frequency". This is only in 2.6.x >>>> kernels. >>>> >>>> If using a 2.4.x kernel then you need to change the clock >>>> frequency manually in the source (look in >>>> linux-2.4.x/include/asm-arm/coldfire.h). >>> >>> It is a 2.4.x kernel and I actually already added the 32MHz option >>> (coldfire.h): >>> >>> --- linux-2.4.x/include/asm-m68knommu/coldfire.h 25 Sep 2007 06:25:01 -0000 1.19 >>> +++ linux-2.4.x/include/asm-m68knommu/coldfire.h 4 Apr 2008 17:46:52 -0000 >>> @@ -38,6 +38,7 @@ >>> /* >>> * Define master clock frequency. >>> */ >>> + >>> #if defined(CONFIG_CLOCK_11MHz) >>> #define MCF_CLK 11289600 >>> #elif defined(CONFIG_CLOCK_16MHz) >>> @@ -50,6 +51,8 @@ >>> #define MCF_CLK 25000000 >>> #elif defined(CONFIG_CLOCK_29_5MHz) >>> #define MCF_CLK 29500000 >>> +#elif defined(CONFIG_CLOCK_32MHz) >>> +#define MCF_CLK 32000000 >>> #elif defined(CONFIG_CLOCK_33MHz) >>> #define MCF_CLK 33000000 >>> #elif defined(CONFIG_CLOCK_40MHz) >>> >>> >>> and an entry in the config.in file for kernel configuration. >>> >>> --- linux-2.4.x/arch/m68knommu/config.in 25 Sep 2007 06:25:01 -0000 1.76 >>> +++ linux-2.4.x/arch/m68knommu/config.in 4 Apr 2008 17:46:09 -0000 >>> @@ -34,7 +34,6 @@ >>> endmenu >>> >>> ############################################################################# >>> - >>> mainmenu_option next_comment >>> comment 'Processor type and features' >>> >>> @@ -93,6 +92,7 @@ >>> 24MHz CONFIG_CLOCK_24MHz \ >>> 25MHz CONFIG_CLOCK_25MHz \ >>> 29.5MHz CONFIG_CLOCK_29_5MHz \ >>> + 32MHz CONFIG_CLOCK_32MHz \ >>> 33MHz CONFIG_CLOCK_33MHz \ >>> 40MHz CONFIG_CLOCK_40MHz \ >>> 45MHz CONFIG_CLOCK_45MHz \ >>> >>> >>> Now I am a little confused about the serial baudrate calculation (I >>> found it is actually in the file drivers/char/mcfserial.c). >>> >>> For the M5282 the calculation is: >>> >>> #else >>> baudclk = ((MCF_BUSCLK / mcfrs_baud_table[i]) + 16) / 32; >>> #endif >>> >>> Which is basically identical to what I found in the manual. Here the >>> baud_rate table entry is number 14 which is 19200. So the baudclck for >>> 32MHz and 66MHz come out to be 52 and 180 respectively. I guess i do not understand why I am getting junk out if the clock calculation here is being mad correctly. I am in the process of looking throiugh the UART UBG settings to se iff there is something I am missing. Any input or hints would be appreciated. >> Seems like you have taken the correct approach. >> >> Regards >> Greg >> >> >> >> ------------------------------------------------------------------------ >> Greg Ungerer -- Chief Software Dude EMAIL: [email protected] >> Secure Computing Corporation PHONE: +61 7 3435 2888 >> 825 Stanley St, FAX: +61 7 3891 3630 >> Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com >> --- >> [email protected] Send a post to the list. >> [email protected] Join the list. >> [email protected] Join the list in digest mode. >> [email protected] Leave the list. >> > > -- ------------------------------------------------------------------------ Greg Ungerer -- Chief Software Dude EMAIL: [email protected] SnapGear -- a Secure Computing Company PHONE: +61 7 3435 2888 825 Stanley St, FAX: +61 7 3891 3630 Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com --- [email protected] Send a post to the list. [email protected] Join the list. [email protected] Join the list in digest mode. [email protected] Leave the list.