µPhone, min mobiltelefon

Berätta om dina pågående projekt.
victor_passe
Inlägg: 2436
Blev medlem: 28 januari 2007, 18:45:40
Ort: Kungsbacka

Re: µPhone, min mobiltelefon

Inlägg av victor_passe »

Nu har äntligen processorn kommit, ska bara löda fast den och programmera in pheers bootloader
Användarvisningsbild
Klas-Kenny
Inlägg: 11836
Blev medlem: 17 maj 2010, 19:06:14
Ort: Växjö/Alvesta

Re: µPhone, min mobiltelefon

Inlägg av Klas-Kenny »

Väntar med högspänning! :P
Användarvisningsbild
Electricguy
Inlägg: 12482
Blev medlem: 15 augusti 2007, 16:52:14
Ort: Kälmä' typ..

Re: µPhone, min mobiltelefon

Inlägg av Electricguy »

*trär en ESD påse över Klas-Kenny*
victor_passe
Inlägg: 2436
Blev medlem: 28 januari 2007, 18:45:40
Ort: Kungsbacka

Re: µPhone, min mobiltelefon

Inlägg av victor_passe »

Nu behöver jag EF:s bootloader kunniga.
Jag hade tänkt att köra på Pheers DS30 loader.
Processorn är en pic24FJ64GA104 som jag vill köra på 32MHz med intern ocsillator och PLL på det.
Uart sitter på RB0 och RB1 som är RP0 och RP1

Processorn ska skicka data på RB0/RP0 och ta emot data på RB1/RP1
På dessa TX och RX sitter en FTDI krets med seriemotstånd på 3K6 som ansluts till datorn.
Det är alltså PIC_RX-3K6-FTDI_TX och PIC_TX-3K6-FTDI_RX

Jag får inte till det, GUI programmet hittar inte bootloadern.
Jag har satt baudrate till 100000Baud, har även testat på 10000
koden:
settings.inc

Kod: Markera allt

;------------------------------------------------------------------------------
;
; Title:			ds30 loader
;
; File description:	user settings and configuration bits for PIC24F, PIC24FJ, PIC24HJ, dsPIC30F, and dsPIC33FJ
;
; Copyright: 		Copyright � 09-11, Mikael Gustafsson
;
; History:			3.0.2 First version of this file
;                                                                             
;------------------------------------------------------------------------------

;-----------------------------------------------------------------------------
;    This file is part of ds30 Loader.
;
;    ds30 Loader is free software: you can redistribute it and/or modify
;    it under the terms of the GNU General Public License as published by
;    the Free Software Foundation.
;
;    ds30 Loader is distributed in the hope that it will be useful,
;    but WITHOUT ANY WARRANTY; without even the implied warranty of
;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;    GNU General Public License for more details.
;
;    You should have received a copy of the GNU General Public License
;    along with ds30 Loader. If not, see <http://www.gnu.org/licenses/>.
;------------------------------------------------------------------------------ 



		
;------------------------------------------------------------------------------
; Device
;------------------------------------------------------------------------------
        ;.equ __24F16KA102, 		1			;xxx uncomment and change if using PIC24F device
        .equ __24FJ64GA104, 		1			;xxx uncomment and change if using PIC24FJ device
        ;.equ __24HJ128GP504, 		1			;xxx uncomment and change if using PIC24HJ device
        ;.equ __30F4011, 			1			;xxx uncomment and change if using dsPIC30F device
        ;.equ __33FJ256GP710, 		1			;xxx uncomment and change if using dsPIC33FJ device


;------------------------------------------------------------------------------
; Includes
;------------------------------------------------------------------------------
        .include	"devices.inc"


;------------------------------------------------------------------------------
; User preferences
;------------------------------------------------------------------------------
		.equiv 	FCY, 				1600000		;xxx speed of internal cycle clock[Hz], used to calculate uart brg and delay
		.equiv	BLINIT,				3000		;xxx hello receive timeout [ms]
		.equiv	HELLOTRIES,			2			;xxx number of non hello characters received before branching to the user application    
		.equiv	BLTIME,				3000		;xxx data receive timeout [ms]
		

;------------------------------------------------------------------------------
; UART settings
;------------------------------------------------------------------------------		
        .equiv	USE_UART1,			1			;xxx uncomment to use uart1
        ;.equiv	USE_UART2,			1			;xxx uncomment to use uart2
        ;.equiv	USE_UART3,			1			;xxx uncomment to use uart3
        ;.equiv	USE_UART4,			1			;xxx uncomment to use uart4
		;.equ	USE_ALTIO,			1			;xxx uncomment to use uart 1 alternative i/o, only for dsPIC30F
		.equiv 	BAUDRATE, 			100000		;xxx baudrate
        ;.equiv	USE_ABAUD,			1			;xxx uncomment to use auto baud rate detection, READ ERRATA FIRST        
        ;.equiv	USE_BRGH,			1			;xxx uncomment to use high baud rates, READ ERRATA FIRST, not available for PIC24F		
		;.equiv	USE_TXENABLE,		1			;xxx uncomment to use a tx enable pin		
		.ifdef USE_TXENABLE
			.equiv	TRISR_TXE,		TRISA		;xxx tris register containing tx enable
			.equiv 	LATR_TXE,		LATA		;xxx port register containing tx enable
			.equiv	TRISB_TXE,		TRISA1		;xxx tris bit for tx enable
			.equiv	LATB_TXE,		RA1			;xxx port bit for tx enable
		.endif



;------------------------------------------------------------------------------
; CAN settings, commercial version only www.ds30loader.com
;------------------------------------------------------------------------------


;------------------------------------------------------------------------------
; Security, commercial version only www.ds30loader.com
;------------------------------------------------------------------------------
		
		
;------------------------------------------------------------------------------
; Advanced settings
;------------------------------------------------------------------------------
		.equiv	PROT_GOTO,			1			;protect goto at 0x00
		.equiv	PROT_BL,			1			;protect bootloader
				
		.ifdef	IS_24F
			.ifndef USE_SECURE
				.equiv	BLPLP,		6			;bootloader placement, pages from end
				.equiv	BLSIZEP,	6			;bootloader size [pages], used by bootloader protection
			.else
				.equiv	BLPLP,		27			;bootloader placement, pages from end
				.equiv	BLSIZEP,	27			;bootloader size [pages], used by bootloader protection
			.endif
		.endif
				
		.ifdef	IS_24FJ
			.ifndef USE_SECURE
				.equiv	BLPLP,		2			;bootloader placement, pages from end
				.equiv	BLSIZEP,	1			;bootloader size [pages], used by bootloader protection
			.else
				.equiv	BLPLP,		2			;bootloader placement, pages from end
				.equiv	BLSIZEP,	2			;bootloader size [pages], used by bootloader protection
			.endif
		.endif
		
		.ifdef IS_24HJ
			.ifndef USE_SECURE
				.equiv	BLPLP,		1			;bootloader placement, pages from end
				.equiv	BLSIZEP,	1			;bootloader size [pages], used by bootloader protection
			.else
				.equiv	BLPLP,		2			;bootloader placement, pages from end
				.equiv	BLSIZEP,	2			;bootloader size [pages], used by bootloader protection
			.endif
		.endif
				
		.ifdef	IS_30F
			.ifndef USE_SECURE
				.equiv	BLPLP,		8			;bootloader placement, pages from end
				.equiv	BLSIZEP,	8			;bootloader size [pages], used by bootloader protection
			.else
				.equiv	BLPLP,		27			;bootloader placement, pages from end
				.equiv	BLSIZEP,	27			;bootloader size [pages], used by bootloader protection
			.endif
		.endif
		
		.ifdef IS_33FJ
			.ifndef USE_SECURE
				.equiv	BLPLP,		1			;bootloader placement, pages from end
				.equiv	BLSIZEP,	1			;bootloader size [pages], used by bootloader protection
			.else
				.equiv	BLPLP,		2			;bootloader placement, pages from end
				.equiv	BLSIZEP,	2			;bootloader size [pages], used by bootloader protection
			.endif
		.endif


;------------------------------------------------------------------------------
; Configuration bits, these macros can be found at the end of the inc-files located in 
; c:\Program files\Microchip\MPLAB ASM30 Suite\Support\dsPIC33F\inc
;
; These can also be set in MPLAB IDE instead, they are found in Configure->Configuration bits...
;------------------------------------------------------------------------------
		.ifdef	IS_24F
			;config	__FBS,	BSS_OFF/*Boot Segment Code Protect*/ & BWRP_OFF/*Boot Segment Write Protect Enable*/
			;config	__FGS,	GCP_OFF/*General Segment Code Protect*/ & GWRP_OFF/*General Segment Write Protect Enable*/
			config	__FOSCSEL,	FNOSC_FRC/*Initial Oscillator Select*/ & IESO_OFF/*Two Speed Start-up*/
			config	__FOSC,	FCKSM_CSDCMD/*Clock switching and Fail-Safe Clock monitor*/ & SOSCSEL_SOSCLP/*Secondary Oscillator Select*/ & POSCFREQ_MS/*Primary Oscillator Frequency Range*/ & OSCIOFNC_ON/*OSCO Pin Configuration*/ & POSCMOD_XT/*Oscillator Selection*/
			;config	__FWDT,	FWDTEN_OFF/*Watchdog Timer*/ & WINDIS_OFF/*Windowed WDT*/ & FWPSA_PR32/*Watchdog prescaler*/ & WDTPS_PS1/*Watchdog postscale*/
			;config	__FPOR, MCLRE_ON/*Master Clear Enable*/ & BORV_LPBOR/*Brown Out Voltage*/ & I2C1SEL_PRI/*I2C1 pins Select*/ & PWRTEN_OFF/*Power Up Timer*/ & BOREN_BOR0/*Brown Out Reset*/
			;config	__FICD, BKBUG_OFF/*Background Debugger*/ & 	ICS_PGx1/*ICD pins select*/
			;config	__FDS,	DSWDTEN_OFF/*Deep Sleep Watchdog Timer*/ & DSBOREN_OFF/*Deep Sleep BOR*/ & RTCOSC_LPRC/*RTCC Reference Oscillator Select*/ & DSWDTOSC_LPRC/*Deep Sleep Watchdog Oscillator Clock Select*/ & DSWDTPS_DSWDTPS0/*Deep Sleep Watchdog Postscale*/
		.endif
				
		.ifdef	IS_24FJ
			config	__CONFIG1, JTAGEN_OFF/*JTAG*/ & GCP_OFF/*code protect*/ & GWRP_OFF/*write protect*//*background debugger*//*clip-on emulation mode*/ & ICS_PGx2/*icd pins select*/ & FWDTEN_OFF/*watchdog timer*/ & WINDIS_OFF/*windowed wdt*/ & FWPSA_PR32/*watchdog prescalar*/ & WDTPS_PS1/*watchdog postscalar*/
			config	__CONFIG2, IOL1WAY_OFF & IESO_OFF/*two-speed startup*/ & FNOSC_FRCPLL/*oscillator selection*/ & FCKSM_CSDCMD/*clock switching and clock monitor*/ & OSCIOFNC_OFF/*OSC0/RC15 function*/ & POSCMOD_XT/*oscillator selection*/
			;config 	__CONFIG3, WPEND_WPSTARTMEM/*write protect range selection*/ & WPCFG_WPCFGDIS/*write protection config page*/ & WPDIS_WPEN/*write protection*/ & WPFP_WPFP8/*Write Protection Flash Page*/
		.endif
		
		.ifdef IS_24HJ
			;config __FBS, 		RBS_NO_RAM & BSS_NO_FLASH & BWRP_WRPROTECT_OFF	;xxx boot segment
			;config __FSS, 		RSS_NO_RAM & SSS_NO_FLASH & SWRP_WRPROTECT_OFF	;xxx secure segment
			;config __FGS,		GSS_OFF & GCP_OFF & GWRP_OFF					;xxx general segment
			config 	__FOSCSEL, 	FNOSC_FRC & IESO_OFF 							;xxx oscillator mode
			config 	__FOSC, 	FCKSM_CSDCMD & OSCIOFNC_ON & POSCMD_XT			;xxx clock switching/clock monitor, osc2 & oscillator selection
			;config	__FWDT,		FWDTEN_OFF & WINDIS_OFF							;xxx watchdog
			;config	__FPOR,		FPWRT_PWR1										;xxx pwm, power-on reset
			;config	__FICD,		BKBUG_ON & COE_ON & JTAGEN_OFF & ICS_PGD1
		.endif
		
		.ifdef	IS_30F
			config 	__FOSC, 	CSW_FSCM_OFF & FRC_PLL16							;xxx oscillator
			config 	__FWDT, 	WDT_OFF												;xxx watchdog
			config 	__FBORPOR,	PBOR_OFF & RST_IOPIN & PWRT_OFF & MCLR_EN			;xxx power-on reset, brown-out reset, master clear
			;config __FGS, 		CODE_PROT_OFF & GWRP_OFF							;xxx code protection
			config 	__FICD, 	ICS_PGD												;xxx comm channel select
		.endif
		
		.ifdef IS_33FJ
			;config	__FBS, 		RBS_NO_RAM & BSS_NO_FLASH & BWRP_WRPROTECT_OFF		;xxx boot segment
			;config	__FSS, 		RSS_NO_RAM & SSS_NO_FLASH & SWRP_WRPROTECT_OFF		;xxx secure segment
			;config	__FGS,		GSS_OFF & GCP_OFF & GWRP_OFF						;xxx general segment
			config 	__FOSCSEL, 	FNOSC_PRI & IESO_OFF 								;xxx oscillator mode
			config 	__FOSC, 	FCKSM_CSECMD & OSCIOFNC_ON & POSCMD_XT				;xxx clock switching/clock monitor, osc2 & oscillator selection
			config	__FWDT,		FWDTEN_OFF & WINDIS_OFF								;xxx watchdog
			;config	__FPOR,		FPWRT_PWR1											;xxx pwm, power-on reset
			;config	__FICD,		JTAGEN_OFF & ICS_PGD1								;xxx 
		.endif


;------------------------------------------------------------------------------
; End of file
;------------------------------------------------------------------------------			
		
uart.inc

Kod: Markera allt

;------------------------------------------------------------------------------
;
; Product:			ds30 Loader
;
; File description:	UART functions for PIC24F, PIC24FJ, PIC24HJ, dsPIC30F, and dsPIC33FJ
;
; Copyright: 		Copyright © 2011, Mikael Gustafsson
;
; History:			3.0.2 first version of this file
;                                                                             
;------------------------------------------------------------------------------


;------------------------------------------------------------------------------
; Verify settings
;------------------------------------------------------------------------------	
		.ifdef USE_UART1
			.ifdef USE_UART2
				.error "Both uarts are specified"
			.endif

		   	.equ    UMODE,	    U1MODE					;uart mode
		   	.equ    USTA,  		U1STA					;uart status
		   	.equ    UBRG,		U1BRG					;uart baudrate
		   	.equ    UTXREG,		U1TXREG					;uart transmit
		   	.equ	URXREG,		U1RXREG					;uart receive
			.equ	UIFS,		IFS0					;uart interupt flag sfr
			.equ	URXIF,		U1RXIF					;uart received interupt flag
			.equ	UTXIF,		U1TXIF					;uart transmit interupt flag		   	
		.endif
		
		.ifdef USE_UART2
			.ifndef HAS_UART2
				.error "UART2 specified for a device that only has uart1"
			.endif	

		   	.equ    UMODE,	    U2MODE					;uart mode
		   	.equ    USTA,  		U2STA					;uart status
		   	.equ    UBRG,		U2BRG					;uart baudrate
		   	.equ    UTXREG,		U2TXREG					;uart transmit
		   	.equ	URXREG,		U2RXREG					;uart receive
			.equ	UIFS,		IFS1					;uart interupt flag sfr
			.equ	URXIF,		U2RXIF					;uart received interupt flag
			.equ	UTXIF,		U2TXIF					;uart transmit interupt flag		   	
		.endif	
		
		; Baud rate 
		.ifdef USE_BRGH
			.equ	UARTBR,		( (((FCY / BAUDRATE) / 2) - 1) / 2 )	/*brg calculation with rounding*/
		.else
			.equ	UARTBR,		( (((FCY / BAUDRATE) / 8) - 1) / 2 )	/*brg calculation with rounding*/
		.endif
		
		; Baudrate error
		.ifndef USE_ABAUD
			.ifdef USE_BRGH
				.equ REALBR,	( FCY / (4 * (UARTBR+1)) )
			.else
				.equ REALBR,	( FCY / (16 * (UARTBR+1)) )
			.endif
			.equ BAUDERR,	( (1000 * ( BAUDRATE - REALBR)) / BAUDRATE )
			.if ( BAUDERR > 25) || (BAUDERR < -25 )
				
				.error "Baudrate error is more than 2.5%. Remove this check or try another baudrate and/or clockspeed."
			.endif 
		.endif
		
					
;------------------------------------------------------------------------------
; CommInit()
;------------------------------------------------------------------------------		
CommInit:		
		.ifdef USE_BRGH	
			bset	UMODE, #BRGH
		.endif		
		.ifdef 	USE_ALTIO
			bset	U1MODE, #ALTIO
		.endif		
		
		;----------------------------------------------------------------------
		;UART without auto baudrate detection
		;----------------------------------------------------------------------
		.ifndef USE_ABAUD
			mov		#UARTBR, W0 		;set	
			mov 	W0, UBRG			; baudrate
			bset 	UMODE, #UARTEN		;enable uart
			bset 	USTA, #UTXEN		;enable transmit
			
			
		;----------------------------------------------------------------------
		;UART with auto baudrate detection
		;----------------------------------------------------------------------
		.else
			; PIC24F, PIC24FJ, PIC24H & dsPIC330FJ
			.ifndef IS_30F
				setm	UBRG			;errata workaround
				bset	UMODE, #ABAUD	;enable auto baudrate
				bset 	UMODE, #UARTEN	;enable uart			
				
				;------------------------------------------------------------------
				; Wait for auto baudrate to complete	
				;------------------------------------------------------------------
				; Init delay
				mov 	#BLSTART, WDEL1
				; Check for auto baud complete
arpt1:			clr		WDEL2
arptc:			clrwdt
				btss 	UMODE, #ABAUD
				bra		abaudok
		 		; Delay
anotrcv:		dec 	WDEL2, WDEL2
				bra 	nz, arptc
				dec 	WDEL1, WDEL1
				bra 	nz, arpt1
				; If we get here, abaud timed out	
				bra		exit	
				; Auto baud rate detection completed
abaudok:		bset 	USTA, #UTXEN		;enable transmit			
				SendL	OK					;confirm baudrate detection to application
			
			; dsPIC30F
			.else
				bset 	UMODE, #UARTEN		;enable UART
				bset 	U1MODE, #ABAUD      ;enable auto baudrate detection			
				; Setp timer 3 
		        clr 	T3CON             	;
		        bclr 	IEC0, #T3IE         ;disable timer 3 interrupt
		        setm 	PR3                 ;maximum period time
		        mov 	#0x8000, W0         ;start, 1:1 prescaler, internal cycle as clock source
		        mov 	W0, T3CON	
		        ; Setp input capture
				mov		#3, W0  	        ;capture mode, every rising edge
		        mov 	W0, IC1CON        	;
		        bclr 	IFS0, #IC1IF        ;clear input capture interrupt flag	
		        ; Begin autobaud detection
				mov 	#0x0004, W0			;detected 4 edges after first 4 edge, total 5 for 0x55
		        rcall 	WaitIC          	;wait for first rising edge
		        clr 	TMR3                ;reset timer 3
edgeloop:   	rcall 	WaitIC
		        dec 	W0, W0 
		        bra 	nz, edgeloop
		        ; Do calculation
		        mov 	TMR3, W0
		        add 	#0x40, W0           ;add 0.5(64/128) => rounding
		        asr 	W0, #7, W0          ;W0 = (Tend - Tstart/ 128) + 0.5
		        dec 	W0, W0			
				; Detection comleted, clean up
				bclr 	T3CON, #TON         ;disable timer 3
		        bclr 	IFS0, #IC1IF        ;clear input capture interrupt flag	        
		        ; Init uart
		        mov 	W0, U1BRG			;use calculated brg
		        bclr 	UMODE, #ABAUD      	;disable auto baudrate detection
		        bclr 	UMODE, #UARTEN		;disable uart
		        clr		USTA				;clear uart status
		        bset 	UMODE, #UARTEN		;enable uart
		        bset 	USTA, #UTXEN       	;enable tx			
				;confirm baudrate detection to application
				SendL	OK					
			.endif						
		.endif
		
		
		;----------------------------------------------------------------------
		; TX enable, make tx enable pin output and set to 0
		;----------------------------------------------------------------------
		.ifdef USE_TXENABLE
			bclr	TRISR_TXE, #TRISB_TXE
			bclr	LATR_TXE, #LATB_TXE
		.endif
		
		return
		
				
;------------------------------------------------------------------------------
; CommExit()
;------------------------------------------------------------------------------
CommExit:		
		bclr	UIFS, #URXIF	;clear uart received interupt flag
		bclr	UIFS, #UTXIF	;clear uart transmit interupt flag
		;bclr 	UMODE, #UARTEN	;disable uart
		;bclr	USTA, #UTXEN	;disable uart transmit
		return
		
				
;------------------------------------------------------------------------------
; Receive()
; Returns: received byte in W0
;------------------------------------------------------------------------------
		; Init delay
Receive:mov 	#BLDELAY, WDEL1
		; Check for received byte
ReceiveInit:
rpt1:	clr		WDEL2
rptc:	clrwdt						;clear watchdog
		btss 	USTA, #URXDA		
		bra 	notrcv
		mov 	URXREG, W0			
		add 	WCRC, W0, WCRC		;add to checksum
		return
 		; Delay
notrcv:	dec 	WDEL2, WDEL2
		bra 	nz, rptc
		dec 	WDEL1, WDEL1
		bra 	nz, rpt1
		; If we get here, uart receive timed out
        bra		exit
	
		
;------------------------------------------------------------------------------
; Send()
; Arguments: W0 - byte to send
;------------------------------------------------------------------------------
Send:	; Enable tx
		.ifdef USE_TXENABLE
			bset	LATR_TXE, #LATB_TXE
			nop
		.endif		
		;Send byte
		mov 	WREG, UTXREG
		nop
		nop
		; Wait until transmit shift register is empty
txwait:	btss	USTA, #TRMT
		bra		txwait
		; Disable tx 
		.ifdef USE_TXENABLE
			bclr	LATR_TXE, #LATB_TXE
		.endif
		; Send complete
		return

			
;------------------------------------------------------------------------------
; WaitIC()
;------------------------------------------------------------------------------
.ifdef IS_30F
.ifdef USE_ABAUD
WaitIC: mov 	#BLDELAY, WDEL1
wicol: 	clr 	WDEL2
wicil: 	clrwdt					;clear watchdog
		btsc 	IFS0, #IC1IF	;rising edge detected?
        bra 	EdgeDet
        dec 	WDEL2, WDEL2
        nop						;nop so we can use same delay as comm.
        nop
        bra 	nz, wicil
        dec 	WDEL1, WDEL1
        bra 	nz, wicol
        ; Timeou
        goto 	usrapp		        
EdgeDet:bclr 	IFS0, #IC1IF    ;clear input capture interrupt flag
        return
.endif
.endif
			

;------------------------------------------------------------------------------
; End of file
;------------------------------------------------------------------------------
zip på hela projektet
firmware 16-bit.zip

Så, nu ska väll inte ens Sodjan kunna klaga på att det är för lite info.
Kan ni hjälpa mig? Jag kan ju inte komma vidare utan bootloader.
Du har inte behörighet att öppna de filer som bifogats till detta inlägg.
Användarvisningsbild
dar303
Inlägg: 5979
Blev medlem: 17 december 2003, 19:54:56
Ort: Sthlm

Re: µPhone, min mobiltelefon

Inlägg av dar303 »

jag är inte mycket till hjälp här (förutom ev bumpning) men näst sista meningen får en :tumupp: :D
victor_passe
Inlägg: 2436
Blev medlem: 28 januari 2007, 18:45:40
Ort: Kungsbacka

Re: µPhone, min mobiltelefon

Inlägg av victor_passe »

Nu har jag kanske kommit lite längre på att få bootloadern att funka.
kod:

Kod: Markera allt

;------------------------------------------------------------------------------
; User specific entry code go here, see also user exit code section at end of file
;------------------------------------------------------------------------------
			
		
		;----------------------------------------------------------------------
		; Make uart pins digital
		;----------------------------------------------------------------------
		.ifdecl ADPCFGL
				mov	#0xFFFF, W0
				mov W0, ADPCFGL
		.endif 
		.ifdecl ADPCFG
				mov	#0xFFFF, W0
				mov W0, ADPCFG
		.endif  		
		.ifdecl ADPCFGLH
				mov	#0xFFFF, W0
				mov W0, ADPCFGLH
		.endif  		
		.ifdecl AD1PCFGL
				mov	#0xFFFF, W0 
				mov W0, AD1PCFGL
		.endif 
		.ifdecl AD1PCFG
				mov	#0xFFFF, W0 
				mov W0, AD1PCFG
		.endif 
		.ifdecl AD1PCFGH
				mov	#0xFFFF, W0 
				mov W0, AD1PCFGH
		.endif 
				mov	#0b0100000101000110, W0 
				mov W0, TRISB
				mov #0,W0
				mov W0, CLKDIV
				mov #0b0001000100000100, W0
				mov W0, OSCCON			
	
;temp:				
;				mov #0xFFFF, W0
;				mov W0, LATB
;				mov #0x0000, W0
;				mov W0, LATB
;				goto temp
;
		
		;----------------------------------------------------------------------
		; UART/CAN pps config
		;----------------------------------------------------------------------
		.ifdef HAS_PPS
				
				; ** IMPORTANT **
				;
				; THIS CODE IS JUST A TEMPLATE AND WILL MOST LIKELY NOT WORK FOR YOU, 
				; READ THE DATASHEET AND ALTER LINES MARKED WITH XXX
				;
				; ** IMPORTANT **
				
				; Backup, these are restored in exit code at end of file
				; Changes needs to be done in exit, search for xxx
				mov		RPINR18, WPPSTEMP1		;xxx
				mov		RPOR7, WPPSTEMP2		;xxx
	
				mov		#OSCCON,W1 
				mov		#0x46,	W2 
				mov		#0x57,	W3 
				mov.b	W2,		[W1] 
				mov.b	W3,		[W1] 
				bclr	OSCCON,	#6 

				; Receive, map pin (14 = 1110) to uart
				bset	RPINR18, #U1RXR0		;xxx
				bclr	RPINR18, #U1RXR1		;xxx
				bclr	RPINR18, #U1RXR2		;xxx
				bclr	RPINR18, #U1RXR3		;xxx
				bclr	RPINR18, #U1RXR4		;xxx
						
				; Transmit, map uart to pin
				bset	RPOR7, #RP0R0			;xxx
				bset	RPOR7, #RP0R1			;xxx
				bclr	RPOR7, #RP0R2			;xxx
				bclr	RPOR7, #RP0R3			;xxx
				bclr	RPOR7, #RP0R4			;xxx

				mov #OSCCON, W1
				mov #0x46, W2 
				mov #0x57, W3 
				mov.b W2, [W1]
				mov.b W3, [W1]
				bset OSCCON, #6
;
;temp:				
;				mov #0xFFFF, W0
;				mov W0, LATB
;				mov #0x0000, W0
;				mov W0, LATB
;				goto temp
;
;
;
		.endif	
		
		
		;----------------------------------------------------------------------
		; Dev
		;----------------------------------------------------------------------		

      			
;------------------------------------------------------------------------------
; Init 
;------------------------------------------------------------------------------
		clr		WDOERASE     			
		rcall	CommInit
		
		
;------------------------------------------------------------------------------
; Receive hello
;------------------------------------------------------------------------------
		mov		#HELLOTRIES, WCNT
rhello:	mov		#BLSTART, WDEL1
		rcall 	ReceiveInit
		;sub 	#HELLO, W0
		;bra		z, rhellofinished		
		; Not hello received
		;dec		WCNT, WCNT
		;bra		z, exit
		;bra		rhello		
rhellofinished:


;------------------------------------------------------------------------------
; Send device id and firmware version
;------------------------------------------------------------------------------
temporary:
		SendL 	DEVICEID
		SendL	(VERMAJ + VERENC + VERMAC)
		SendL	(VERMIN<<4 + VERREV)
		goto	temporary

i filen ds30loader.s
Men den bör här skicka lite data hela tiden men jag får ingen data och TX pinnen är 0V så uarten blir inte initierad.

Ska kolla vidare.
victor_passe
Inlägg: 2436
Blev medlem: 28 januari 2007, 18:45:40
Ort: Kungsbacka

Re: µPhone, min mobiltelefon

Inlägg av victor_passe »

om jag ändrar:

Kod: Markera allt

		clr		WDOERASE     			
		rcall	CommInit
till

Kod: Markera allt

		clr		WDOERASE     			
		rcall	CommInit
		


temp:				
				mov #0xFFFF, W0
				mov W0, LATB
				mov #0x0000, W0
				mov W0, LATB
				goto temp

Så togglar TX mellan 1 och 0, men uarten ska ju vara aktiv så den borde inte kunna togglas.
Så troligtvis tar inte PPS:en.
blueint
Inlägg: 23238
Blev medlem: 4 juli 2006, 19:26:11
Kontakt:

Re: µPhone, min mobiltelefon

Inlägg av blueint »

PPS?

Känns som att det inte finns något som svarar på UART i processorn. Som om bootloader ej fanns.
zealotry
Inlägg: 919
Blev medlem: 9 oktober 2004, 22:28:40
Ort: Västerås

Re: µPhone, min mobiltelefon

Inlägg av zealotry »

Och allting gick smidigt när du laddade över boot loadern?
bearing
Inlägg: 11675
Blev medlem: 2 mars 2006, 01:01:45
Ort: Ängelholm

Re: µPhone, min mobiltelefon

Inlägg av bearing »

Victor, har du ändrat de markerade raderna nedanför:

Kod: Markera allt

      ;----------------------------------------------------------------------
      ; UART/CAN pps config
      ;----------------------------------------------------------------------
      .ifdef HAS_PPS
            
            ; ** IMPORTANT **
            ;
            ; THIS CODE IS JUST A TEMPLATE AND WILL MOST LIKELY NOT WORK FOR YOU,
            ; READ THE DATASHEET AND ALTER LINES MARKED WITH XXX
            ;
            ; ** IMPORTANT **
?
victor_passe
Inlägg: 2436
Blev medlem: 28 januari 2007, 18:45:40
Ort: Kungsbacka

Re: µPhone, min mobiltelefon

Inlägg av victor_passe »

Problemet är alltså att PPS inte ändras som jag vill när jag sätter den till uart och RP0,RP1
Med följande kod:

Kod: Markera allt

	
				; ** IMPORTANT **
				;
				; THIS CODE IS JUST A TEMPLATE AND WILL MOST LIKELY NOT WORK FOR YOU, 
				; READ THE DATASHEET AND ALTER LINES MARKED WITH XXX
				;
				; ** IMPORTANT **
				
				; Backup, these are restored in exit code at end of file
				; Changes needs to be done in exit, search for xxx
				mov		RPINR18, WPPSTEMP1		;xxx
				mov		RPOR7, WPPSTEMP2		;xxx
	
				push	W2
				mov		#OSCCON,W0 
				mov		#0x46,	W1 
				mov		#0x57,	W2 
				mov.b	W1,		[W0] 
				mov.b	W2,		[W0] 
				bclr	OSCCON,	#6
				pop		W2 ;Unlock PPS 
				
				; Receive, map pin (14 = 1110) to uart
				bset	RPINR18, #U1RXR0		;xxx
				bclr	RPINR18, #U1RXR1		;xxx
				bclr	RPINR18, #U1RXR2		;xxx
				bclr	RPINR18, #U1RXR3		;xxx
				bclr	RPINR18, #U1RXR4		;xxx
						
				; Transmit, map uart to pin
				bset	RPOR7, #RP0R0			;xxx
				bset	RPOR7, #RP0R1			;xxx
				bclr	RPOR7, #RP0R2			;xxx
				bclr	RPOR7, #RP0R3			;xxx
				bclr	RPOR7, #RP0R4			;xxx

				
				mov 	#OSCCON, W0
				mov 	#0x46, W1
				mov 	#0x57, W2 
				mov.b 	W1, [W0]
				mov.b 	W2, [W0]
				bset 	OSCCON, #6 ;Lock PPS
bearing
Inlägg: 11675
Blev medlem: 2 mars 2006, 01:01:45
Ort: Ängelholm

Re: µPhone, min mobiltelefon

Inlägg av bearing »

Kan inget om PPS, men jag skummade igenom registertabellerna och tror att jag hittat felet. Du har använt RPOR7 i koden ovan. Ändra till RPOR0 så kommer det nog att funka.

Det verkar stå fel i databladet, för det står att bitfältet RP15R<4:0> har med RP0 att göra, vilket antagligen är ett kopiera/klistra fel av någon på Microchip. RP15R<4:0> i RPOR7 har med RP15 att göra, och RP0R<4:0> i RPOR0 har med RP0 att göra.
victor_passe
Inlägg: 2436
Blev medlem: 28 januari 2007, 18:45:40
Ort: Kungsbacka

Re: µPhone, min mobiltelefon

Inlägg av victor_passe »

RPOR7 är vart uart ska mappas, inte RP0
Jag tycker att det är en djungel.
Men jag ska testa att byta.
Användarvisningsbild
toffie
Inlägg: 1888
Blev medlem: 22 juli 2004, 21:38:07
Ort: Töreboda / Stockholm
Kontakt:

Re: µPhone, min mobiltelefon

Inlägg av toffie »

Mindre kod, mer foton!! :O
Jag vill se maaaaassa mer foton, har du nåt mer att bjuda på victor? :D
victor_passe
Inlägg: 2436
Blev medlem: 28 januari 2007, 18:45:40
Ort: Kungsbacka

Re: µPhone, min mobiltelefon

Inlägg av victor_passe »

När ni har löst mina problem får ni foton.... Nej, men jag vill fixxa bootloadern först. Sedan ska jag fota och posta.
Skriv svar