Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PIC18f45k22
#1
Hello,

I am having a issue with uP reconition. (ds30 GUI loader)

Code:
Device reset completed
Searching for bl . . . (discarded null byte) (discarded null byte) . . (discarded null byte) . . . . . (discarded null byte) . . (discarded null byte) . . .
Found PIC24FJ256DA110 fw ver. 0.0.0
Wrong pic detected(255/FF)/selected(346/15A), aborting
Closing port
Tx 15 bytes / Rx 8 bytes / 9.6s
Write failed

I have allready looked here:
[broken link]
I am using UART1. 1 Mhz  internal clock. 
With the  discarded It is telling me that it is a config issue. (but close) 
Code is attached. Any help you can provide would be extreamly helpfull. I am not a ASM guy. So, this is new teritory....


Attached Files
.zip   ds30Loader.X.zip (Size: 95.51 KB / Downloads: 24)
Reply
#2
Hi,
You say 1MHz but the code comment says 16MHz. Which is it?
Reply
#3
(2015-03-06, 14:43:07)Mikael Gustavsson Wrote: Hi,
You say 1MHz but the code comment says 16MHz. Which is it?

I had the 16 Mhz stuff comented out. I did how ever change it to 16 Mhz

Code:
           ; Set internal oscillator to 16MHz
           movlw 0x72
           movwf OSCCON
           movlw 0x04
           movwf OSCCON2

Code:
;------------------------------------------------------------------------------
; User preferences
;------------------------------------------------------------------------------
        radix DEC
        
        #define        OSCF            16000000    ;xxx oscillator frequency (including pll)
        #define        BLINIT            2000        ;xxx hello receive timeout [ms]
        #define        HELLOTRIES        2            ;xxx number of non hello characters received before branching to the user application
        #define        BLTIME            2000        ;xxx data receive timeout [ms]


;------------------------------------------------------------------------------
; UART settings
;------------------------------------------------------------------------------            
        #define        USE_UART1        1            ;xxx uncomment to use uart1
        ;#define    USE_UART2        1            ;xxx uncomment to use uart2
        #define        BAUDRATE         19200        ;xxx baudrate
       ;#define    USE_ABAUD        1            ;xxx uncomment to use auto baud rate detection, READ ERRATA FIRST        
        #define    USE_BRG16        1            ;xxx uncomment to use 16-bit brg

        ;#define    USE_TXENABLE    1            ;xxx uncomment to use a tx enable pin
        ifdef USE_TXENABLE
            #define    TXE_DELAY         10            ;xxx time in us to wait before transmitting after pulling the tx enable pin high
            #define    TRISR_TXE        TRISD        ;xxx tris register containing tx enable
            #define    LATR_TXE        LATD        ;xxx port register containing tx enable
            #define    TRISB_TXE        TRISD0        ;xxx tris bit for tx enable
            #define LATB_TXE        RD0            ;xxx port bit for tx enable
        endif

I also set the GPIO to a known good setting.

Code:
     movlw 0x00
          movwf LATA
          movlw 0xF7
          movwf TRISA
          movlw 0x20
          movwf ANSELA
          movlw 0x00
          movwf LATB
          movlw 0xD7
          movwf TRISB
          movlw 0x00
          movwf ANSELB
          movlw 0x00
          movwf WPUB
          movlw 0x18
          movwf LATC
          movlw 0xFF
          movwf TRISC
          movlw 0x04
          movwf ANSELC
          movlw 0x00
          movwf LATD
          movlw 0xFD
          movwf TRISD
          movlw 0xDD
          movwf ANSELD
          movlw 0x00
          movwf LATE
          movlw 0x00
          movwf TRISE
          movlw 0x00
          movwf ANSELE
I attached project code as it is right now. 


Attached Files
.zip   ds30Loader.X.zip (Size: 95.51 KB / Downloads: 4)
Reply
#4
I am still having issues with the baud rate / UART.  Any ideas? Info above ^
Reply
#5
What is the problem now? Did you measure the actual baud rate on PIC tx?
Reply
#6
(2015-03-15, 19:29:36)Mikael Gustavsson Wrote: What is the problem now? Did you measure the actual baud rate on PIC tx?

it is still giving me the same issue as i had before:

Code:
Device reset completed
Searching for bl . . . (discarded null byte) (discarded null byte) . . (discarded null byte) . . . . . (discarded null byte) . . (discarded null byte) . . .
Found PIC24FJ256DA110 fw ver. 0.0.0
Wrong pic detected(255/FF)/selected(346/15A), aborting
Closing port
Tx 15 bytes / Rx 8 bytes / 9.6s
Write failed

How would I mesure the baud rate? It sems nothing is coming out of the pic now. 

Thnks for your help!
Reply
#7
Post the current code.
Reply
#8
(2015-04-05, 21:04:06)Mikael Gustavsson Wrote: Post the current code.


Attached Files
.zip   ds30Loader-Pic18F.X.zip (Size: 127.26 KB / Downloads: 25)
Reply
#9
I managed to get the PIC18F46K22 working. The baudrate division needs to be adapted and the output directon of the SEND pin needs to be set.

Some code snippets:
user_code.inc:
            bsf    TRISC, 7        ; make RX input (default)
            bcf    TRISC, 6        ; make TX output

ds30loader.asm:
#define    UBRG    (((OSCF / BAUDRATE) / 64) - 1)   

If you don't use BRG16, that is.
Reply
#10
The brg calculation is correct. If you need to change it you have either disabled BRGH or set the OSCF define incorrectly.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)