pic18f4550 hangs.. RX_INT DT_INTS-18.. please help


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2011
    Posts
    21

    Default pic18f4550 hangs.. RX_INT DT_INTS-18.. please help

    Hello
    below is my code. i am using pic18f4550. light start to blink as expected but when anything is sent serially it hangs pic and blinking light stops.
    Code:
    DEFINE RESET_ORG 0x1000
    DEFINE OSC 48       
    adcon1 = 15 
    
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 9600
    SerialData var     byte
    RXIF       VAR     PIR1.5
    TXIF       VAR     PIR1.4
    
    DEFINE  USE_LOWPRIORITY  1
    ;--- Setup Interrupts ------------------------------------------------------
    INCLUDE "DT_INTS-18.bas"     ; Base Interrupt System
    include "ReEnterPBP-18.bas"
    include "ReEnterPBP-18LP.bas"
    
    ASM
    INT_LIST  macro    ; IntSource,          Label,  Type, ResetFlag?
            INT_Handler   USB_Handler 
        endm
        INT_CREATE               ; Creates the interrupt processor
        
    INT_LIST_L  macro  ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler     RX_INT,     _Receive,   PBP,  no
        endm
        INT_CREATE_L
    endasm
    
    @    INT_ENABLE  RX_INT
    
    ;--- Setup USB -------------------------------------------------------------
    INCLUDE "DT_HID260.pbp"
    
    DEFINE USB_VENDORID    6017
    DEFINE USB_PRODUCTID   2000
    DEFINE USB_VERSION     1
    DEFINE USB_VENDORNAME  "Test"
    DEFINE USB_PRODUCTNAME "Test"
    DEFINE USB_SERIAL      "001"
    DEFINE USB_INSIZE      64;32   ;  IN report is PIC to PC (8,16,32,64)
    DEFINE USB_OUTSIZE     64;16   ; OUT report is PC to PIC
    DEFINE USB_POLLIN      10   ; Polling times in mS, MIN=1 MAX=10
    DEFINE USB_POLLOUT     10
    
    ; --- Each USB LED is optional, comment them if not used ----
    DEFINE USB_LEDPOLARITY 1       ; LED ON State [0 or 1]  (default = 1)
    DEFINE USB_PLUGGEDLED  PORTB,0 ; LED indicates if USB is connected
    DEFINE USB_TXLED       PORTC,2 ;  "      "     data being sent to PC
    DEFINE USB_RXLED       PORTC,1 ;  "      "     data being received from PC
    
    main:
        Toggle porta.0
        pause 50
    goto main
    
    Receive:
           HSERIN [Serialdata] 
           hserout [Serialdata,13,10]
    back:
    @ INT_RETURN
    any suggestions appreciated.
    thank you

  2. #2
    Join Date
    Jul 2011
    Posts
    21


    Did you find this post helpful? Yes | No

    Default Re: pic18f4550 hangs.. RX_INT DT_INTS-18.. please help

    ok i think i found the issue and its because of reset vector. i am using bootloader to send firmware, after bootloader writes the firmware it works till interrupt occurs.

    can anyone tell how to rewrite/change reset vector in PBP, i have searched but didn't found anything?
    thank you

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,520


    Did you find this post helpful? Yes | No

    Default Re: pic18f4550 hangs.. RX_INT DT_INTS-18.. please help

    Hi,
    Which bootloader are you using?
    Usually when using a bootloader you do DEFINE LOADER_USED 1 but to answer your question you should be able to do DEFINE RESET_ORG 0080h or whatever.

    /Henrik.

  4. #4
    Join Date
    Jul 2011
    Posts
    21


    Did you find this post helpful? Yes | No

    Default Re: pic18f4550 hangs.. RX_INT DT_INTS-18.. please help

    Hi Henrik,

    Thanks for reply. i am sorry i mean interrupt vector

    i have written my own code similar to bootloader using PBP and DT-INTS. this is what happens, it first receive firmware from USB and writes it to external EEPROM, then read it and reprogram flash and jump to the new firmware (@goto). Now i think my issue is when an interrupt occurs in the new firmware it looks into bootloader interrupt vector for corresponding routine to execute, since no reference exists there it hangs/resets. if somehow i can put new interrupt vector then i think problem would be solved.
    i would really appreciate any suggestions
    thank you

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,520


    Did you find this post helpful? Yes | No

    Default Re: pic18f4550 hangs.. RX_INT DT_INTS-18.. please help

    Oh! Yeah, that's a bit of a difference....
    The interrupt vectors are as far as I know something defined in the hardware of the chip itself. Location 0x0008h is the high priority interrupt vector and 0x0018h is the low priority interrupt vector. I don't see any way to change that.

    Are both your bootloader AND the application using DT-INTS? I have no idea how that should/would/could work....

    /Henrik.

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