PIC18F4550 to 18F4553 Comm Issue?


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    http://www.microchip.com/wwwproducts/en/PIC18F4553

    At quick glance, they both use the same pins for EUSART, so that's a good thing.

    Check out this funky register on the 4553: DEVID1. EDIT: never mind, The Device ID registers are “read-only” registers

    Don't look for more pages in a 4553 datasheet, there are none:
    This document is supplemented by the “PIC18F2455/2550/4455/4550 Data Sheet”
    It is compatible with the 4550, so you're missing something very small if you already have it working between two 4550.

    Hmm, very dumb question: have you changed the model when you compile?

    Robert
    Last edited by Demon; - 13th April 2016 at 02:28.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,641


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    page 7 of the "46 page abridged version"

    Note:
    This data sheet documents only the
    devices’ features and specifications that are
    in addition to the features and specifications
    of the PIC18F2455/2550/4455/4550
    devices. For information on the features
    and specifications shared by
    the PIC18F2458/2553/4458/4553 and
    PIC18F2455/2550/4455/4550 devices,
    see
    the PIC18F2455/2550/4455/4550

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    to trouble shoot I put an LCD message in the receive interrupt routine with a pause, the message is never displayed.
    PAUSE within an interrupt aren't a good idea.

    Set a flag to 0,
    Set it within your routine,
    Then check it within your main program.

    What if you copy your programs for both pics down to bare EUSART code and try to get them talking?

    Are you sure it worked right before with two 4550?

    Uh, did you put the 4553 in backwards?

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  4. #4
    Join Date
    Apr 2009
    Location
    Boise, Id
    Posts
    44


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    Thanks for the responses, I can stop looking for the rest of the data sheet. I was too busy looking for fine print I overlooked the highlighted section that says it's the same as the 4550.

    I did get wires connected between the 4553 board and my PC. I put an HSEROUT in my main routine to send a message out once per second. All I get is qbert "«Š¥h” ejg«üa©Š¥Gh” ", I can move the wires to the 4550 board and the message displays fine.

    The 4553 isn't in backward (I've done that before, so it's the first thing I check now!). I also have an LCD and LED's that are driven from the 4553, those all work fine.

    I'll start a new program for the 4553 and just put in the bare EUSART as suggested. Hopefully I can find my error.

    Let me know if you have any other idea's.
    Thanks

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    If your LED and LCD work fine on the 4553, then that PIC is working fine.

    If your 4550 can talk to another 4550, then that PIC is working fine.

    Are you using the right TX/RX pins on the 4553?

    There's really not a lot of possibilities here. The 4553 is EUSART compatible with a 4550. It is basically a 4550 with a different name.

    Do you use different wires?

    Do you do a simple drop-in substitution for the 4553, or do you have a separate breadboard circuit set up?

    What about a heartbeat LED?
    Main:
    LEDout = 0
    PAUSE 500
    LEDout = 1
    PAUSE 500
    GOTO Main
    END
    If you're using a separate circuit for the 4553, does this do a 1 second pulse?
    (I was thinking of a timing issue, LED and LCD might work fine, but EUSART would be more finicky)

    Just trying to eliminate all possibilities I can come up with.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  6. #6
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    No expert, but these are things I look at when having issues with serial coms.

    Timing: The crystal and OSC value need to be right. On one project the code ran and the program functioned, but when communications was tested I got garbage streamed out to the PC. I then changed the xtal from 12mhz to a 10mhz and it worked fine.

    Try something like this with a 10mhz crystal fitted

    Code:
    DEFINE  OSC 20                          ' 18F4520, 10mhz crystal
    ADCON1 = $0F
    clear 
    
     ;----[UART Settings]------------------------------------------------------------
    
    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 8   ' 9600 Baud @ SPBRGH = 2
    BAUDCON.3 = 1         ' Enable 16 bit baudrate generator
    
    
    RCSTA = $90   ' Enable serial port & continuous receive
    TXSTA = $24   ' Enable transmit, BRGH = 1
    SPBRG = 8     ' 9600 Baud @ -0.03%
    SPBRGH = 2
    BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
    
    
    RCIF                VAR PIR1.5                    ' USART receive flag
    Char                VAR BYTE                      ' USART byte received
    GIE                 VAR INTCON.7
    Then try your HSEROUT routine

    There was a useful calculator that worked out the settings based on the timings which might help http://www.picbasic.co.uk/forum/showthread.php?t=4994

  7. #7
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    Another option is to use the built-in oscillator. That's what I used here on the slave 18F44K22 and ran at 115,200:

    http://www.picbasic.co.uk/forum/show...524#post130524

    Master 18F4550 at 48 MHz using external 20MHz oscillator
    Slave 18F44K22 at 64 MHz using internal oscillator

    If I read the datasheet right, the internal oscillator is limitted at 8 MHz on the 4550. Maybe that's enough for your needs.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  8. #8
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    I see no reason why you couldn't use an external 20 MHz crystal on the 4550 and 4553, and run them at 48 MHz.

    Try with these settings, I know these worked.

    Code:
    ' 184550 external oscillator 20MHz
    ...
    DEFINE OSC 48
    ...
    DEFINE HSER_RCSTA 90h               ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h               ' Enable transmit, BRGH = 0
    DEFINE HSER_CLROERR 1               ' Clear overflow automatically
    DEFINE HSER_SPBRG 25                ' 115200 Baud @ 48MHz, 0,16%
    SPBRGH = 0
    BAUDCON.3 = 1                       ' Enable 16 bit baudrate generator
    I used 22pF ceramic caps on the crystal.

    Like these round brown ones:
    http://www.capacitorguide.com/ceramic-capacitor/

    Also, notice this has a low error percentage despite the higher rate, only 0.16% compared to your 1.36% (I'm assuming negative is irrelevant on this value, I could be wrong).

    One last thing, 48 MHz on the 4550 would let you use USB later if that's a requirement.

    Robert
    Last edited by Demon; - 14th April 2016 at 00:03.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  9. #9
    Join Date
    Apr 2009
    Location
    Boise, Id
    Posts
    44


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    Still no luck, the data I receive on my PC is garbled from the 4553, I've tried dozens of baud rates and settings. I plugged the com back into a board with a 4550 and the data from it is fine. Both are running external 20 MHz crystals, boards and design is similar. I copied the code and board design from the 4550 and just changed what I needed to for the new design. I tried the suggested settings from here and had the same results. I got an error when I changed the OSC to 48.

    Also, my title may be confusing. What I'm doing is upgrading from a 4550 to 4553 on a board design/upgrade, the EUSART comm isn't working correct on the 4553 yet.

    Tomorrow I'll take one of the boards, de-solder the 4553 and put the 4550 on it just so I can completely double check for an issue with the board.

    As a little backstory the boards take external values and send the information via a cell phone to a remote server. This is working fine on boards with the 4550, but we wanted the 12bit AD for the next phase.

    The cell phone needs a baud of 115200.

    I'm not sure if something that I have configured might load defaults a little different from the 4550 to 4553?

    Below is the current DEFINES and CONFIGS, after this I set some variables and have a 1 second loop the sends HSEROUT ["Hello",13,10], toggles an LED and updates a seconds counter on the LCD. Data received by PC acts like the baud rate its bad, LED blink and LCD updates fine.

    Let me know if you think of anything that may help.
    Thanks

    Code:
    Define OSC 20
    
       
    DEFINE LCD_DREG          PORTD  'Port used for LCD Data
    DEFINE LCD_DBIT          0      'First Pin connected to LCD DB4
    DEFINE LCD_RSREG         PORTB 'Port used for LCD RS line
    DEFINE LCD_RSBIT         2     'Pin used for LCD RS line
    
    DEFINE LCD_EREG          PORTA 'Port used for LCD E Reg
    DEFINE LCD_EBIT          4     'Pin used for LCD E line
    DEFINE LCD_BITS          4     'Four bit comm mode
    DEFINE LCD_LINES         2     '2 Line LCD
    DEFINE LCD_COMMANDUS     900    'Delay between sending LCD commands
    DEFINE LCD_DATAUS        75      'Delay time between data sent
      
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h  'External Clock, Enable transmit, BRGH = 1
    DEFINE HSER_SPBRG 10 ' 115200 Baud @ 20MHz, -1.36%   
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically  
     BAUDCON.3 = 0        ' BRG16 = 0      
     
      TRISC.7=1
      TRISC.6=1      
            
            
      'Re-Configure default values from the PBP 18F4553.inc and MCSP/MPASM .inc
            
       ' Ext XTAL setting
         '_PLLDIV_5_1L  20Mhz HS / 5 for PLL 4 Mhz
        '_CPUDIV_OSC3_PLL4_1L  24Mhz CPU for USB 1 speeds, PLL 96Mhz/4 =24Mhz
        'HS oscillator, PLL enabled (HSPLL)  
           '                   
        'asm
        #CONFIG
              __CONFIG  _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC3_PLL4_1L & _USBDIV_2_1L
              __CONFIG  _CONFIG1H, _FOSC_HSPLL_HS_1H
        #ENDCONFIG   
        'endasm
        
        INCLUDE "DT_INTS-18.bas"     ; Base Interrupt System
        INCLUDE "ReEnterPBP-18.bas"     ; Include if using PBP interrupts
        INCLUDE "Elapsed_INT-18.bas"  ; Elapsed Timer Routines
        ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
                INT_Handler    TMR1_INT,  _ClockCount,   PBP,  yes
                INT_Handler    RX_INT,     _Check_Command, PBP, yes 
            endm
            INT_CREATE               ; Creates the interrupt processor
        ENDASM
    
       
    @ INT_ENABLE    TMR1_INT     
    @ INT_ENABLE    RX_INT

  10. #10
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    Code:
    ' 184550 external oscillator 20MHz
    ...
    DEFINE OSC 48
    ...
    DEFINE HSER_RCSTA 90h               ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h               ' Enable transmit, BRGH = 0
    DEFINE HSER_CLROERR 1               ' Clear overflow automatically
    DEFINE HSER_SPBRG 25                ' 115200 Baud @ 48MHz, 0,16%
    SPBRGH = 0
    BAUDCON.3 = 1                       ' Enable 16 bit baudrate generator
    I should have included the CONFIGs though, they are still in PBP v2.60c format but the settings are easily convertible:
    Code:
    @   __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    @   __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
    @   __CONFIG    _CONFIG2L, _PWRT_OFF_2L & _BOR_ON_2L & _BORV_1_2L & _VREGEN_ON_2L
    @   __CONFIG    _CONFIG2H, _WDT_OFF_2H
    @   __CONFIG    _CONFIG3H, _CCP2MX_OFF_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_ON_3H
    @   __CONFIG    _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
    But Richard is a senior member for a reason.

    Robert
    Last edited by Demon; - 15th April 2016 at 01:16.

Similar Threads

  1. RS232 comm
    By longdw in forum Serial
    Replies: 9
    Last Post: - 15th September 2009, 03:13
  2. trade 18F4553-I/P (really want 16c717/JW)
    By nomad in forum Adverts
    Replies: 2
    Last Post: - 1st November 2008, 22:49
  3. Code Issue - select case or 'if' issue - not sure why
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th October 2007, 08:52
  4. serial comm problem
    By win_832001 in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 29th June 2006, 13:57
  5. Serial comm Problems
    By Fossil in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th January 2004, 02:29

Members who have read this thread : 0

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