Can't set 38400 baud @ 48Mhz


Closed Thread
Results 1 to 39 of 39

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    i suspect a asm math overflow, but can't reproduce it here... and... HSER_BAUD is not define so... i'm lost

    Even worst.. if does the same thing even by writing to the USART register ???

    what happen if you use only the CONFIG fuse, DEFINE OSC AND HSER DEFINEs?

    edit: OK only by writing to the REGISTER, you'll have this error once you add a HSEROUT line, but it fix the problem when you use the DEFINEs as generated by the PicMulticalc as bellow
    Code:
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    DEFINE HSER_SPBRG 56  ' 38400 Baud @ 48MHz, -0.16%
    SPBRGH = 1
    BAUDCON.3 = 1         ' Enable 16 bit baudrate generator
    So the DEFINEs have to be there IF you're using HSEROUT/HSERIN... just because PBP try to load HSER_SPBRG and everything else
    simple code
    Code:
    DEFINE OSC 48
    RCSTA = $90   ' Enable serial port & continuous receive
    TXSTA = $24   ' Enable transmit, BRGH = 1
    SPBRG = 56    ' 38400 Baud @ 48MHz, -0.16%
    SPBRGH = 1
    BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
    
    HSEROUT ["HELLO"]
    and it's .LST around warning 202
    Code:
    Warning[202]: Argument out of range.  Least significant bits used.
    000018 0E38           07668         movlw   HSER_SPBRG
    00001A 6EAF           07669         movwf   SPBRG           ; Set baud rate generator reg
                          07670     ifdef HSER_SPBRGH
                          07671       ifdef SPBRGH
                          07672         movlw   HSER_SPBRGH
                          07673         movwf   SPBRGH          ; Set baud rate generator reg high
                          07674       endif
                          07675     endif
    00001C 0E20           07676         movlw   HSER_TXSTA
    00001E 6EAC           07677         movwf   TXSTA           ; Set transmit control reg
    000020 0E90           07678         movlw   HSER_RCSTA
    000022 6EAB           07679         movwf   RCSTA           ; Set receive control reg
    INTERESTING !!!! HSER_SPBRGH is not even listed in the new PBP manual!!!
    Last edited by mister_e; - 7th March 2007 at 05:49.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Yup, you got it Steve.

    Without the Define's, PBP defaults to 2400 baud and BRGH=0, which is too low for 48mhz.

    But, in the first post, the defines were there. And those defines compile just fine.

    So confused.

    DT

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    yeah, weird... maybe a beta V2.46? who knows
    12:14 here so
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Beta 2.46

    DT

  5. #5
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Beta 2.46
    You laugh...but for some reason I think I might have a one-off version of 2.46. I got it a couple of months after it came out. Then noticed that patch awhile after that, still haven't been able to get that applied successfully. Some of the PBP INC files are labelled 2.45, some much earlier than that (but then again, no need to waste time by renaming stuff if you didn't do anything to it right?). I emailed Jeff about it awhile back, he sent me an email back, I never did get around to sending a copy of my registration, etc. to get a new CD and he mentioned 2.47 was on it's way out, so I held off...
    I'm wondering if this 2.46 isn't my problem with the SPI on the '4620, worked fine on the '452, never could get it to work on the '4620. Maybe 2.47 will fix that too, maybe Microchip will someday publish another errata...

    At any rate... I still wonder if the original poster could easily get around this whole problem by setting the register values manually instead of relying on the compiler to handle it automatically...

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Woooaa, there's an Idea.

    Jerry,

    Have you run the Patch for 2.46 yet?
    http://www.melabs.com/support/patches.htm

    I did a long time ago, forgot all about it.

    Good thought skimask.

    P.S. The 2.47 upgrade will fix that if you didn't.

    P.P.S. The patch is a PITA. because if you have modified the .INC files (like we all do for the configs), it won't run, until you undo the changes. If you haven't done it yet, just wait for 2.47. It'll save you a few hours of horror.

    DT

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    Quote Originally Posted by Darrel Taylor View Post
    P.P.S. The patch is a PITA.
    mmm PITA

    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 21:58
  2. Auto Baud Rate Detection
    By mytekcontrols in forum Serial
    Replies: 10
    Last Post: - 31st October 2005, 03:17
  3. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 15:31
  4. help
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th February 2005, 21:42
  5. Need once your help one please
    By zugvogel1 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 9th February 2005, 21:33

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts