[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [N8VEM: 6434] Newbie frustrations -- information overload



Max,

As I don't seem to have write access to that archive, and the re-write of "INIT_UART" is fairly short, I attach the updated routine here. It is entirely re-written to be significantly shorter, and adds the initialization of UART4, the ModemStatusRegister.

--John


On 03/10/2010 12:48 PM, Max Scane wrote:
Hi John,

Great catch! I haven't had that particular problem but I know of others who have. The serial cable and its wiring has been the source of several problems and dead looking boards. Making that more reliable will be of benefit to everyone especially new builders.

I suspect that you might also have problems with Xmodem as it is sensitive to modem signals as well.

Perhaps you could post the relevant code sections here or upload you file to the bios sync section of the wiki?

http://n8vem-sbc.pbworks.com/browse/#view=ViewFolder&param=BIOS%20Sync <http://n8vem-sbc.pbworks.com/browse/#view=ViewFolder&param=BIOS%20Sync>

Thanks for your support.

Regards,

Max



;******************************************************************
;*	INIT_UART
;*	Function	: Init serial port  8250, 16C450, OR 16C550
;*			9600 Baud, 8 bit, 1 stopbit, 0 parity
;*	Output		: none
;*	call		: PAUSE
;*	tested		: 2 Feb 2007
;******************************************************************

INIT_UART:
	LD	A,$AA
	OUT	(UART7),A
	IN	A,(UART7)
	CP	$AA	; TEST IF YOU COULD STORE AA
	JP	NZ,INITUART_FAIL	; IF NOT, THE UART CAN'T BE FOUND
	LD	A,$55
	OUT	(UART7),A		; 
	IN	A,(UART7)
	CP	$55			; 
	JP	NZ,INITUART_FAIL
	LD	A,$01
	LD	(SER_ON),A
	JP	UART_OK

INITUART_FAIL:				; Handle if initialize UART fails
	LD	A,1
	LD	(UART_FAIL),A
STOPIT:	HALT
        JP      STOPIT


UART_OK:
	LD	A,0
	LD	(UART_FAIL),A		; UART OK FOUND
	LD	A,(SER_BAUD)

        LD      HL,1                    ; DIVISOR 115200 / 1 -> 115200
	CP	8
	JP	Z,UART_PROG
        ADD     HL,HL                   ; 2 -> 57600
        CP      7
	JP	Z,UART_PROG
        LD      HL,3                    ; 3 -> 38400
        CP      6
	JP	Z,UART_PROG
        ADD     HL,HL
        CP      5                       ; 6 -> 19200
	JP	Z,UART_PROG
        ADD     HL,HL
        CP      4                       ; 12 -> 9600
	JP	Z,UART_PROG
        ADD     HL,HL
        CP      3                       ; 24 -> 4800
	JP	Z,UART_PROG
        ADD     HL,HL
        CP      2                       ; 48 -> 2400
	JP	Z,UART_PROG
        ADD     HL,HL                   ; 96 -> 1200
;  A = 1 OR UNKNOWN VALUE, DIVISOR IS 96 -> 1200 BAUD IS THE DEFAULT
					; IF NOTHING IS DEFINED 1200 WILL BE USED..

UART_PROG:
	LD	A,80H
	OUT	(UART3),A		; SET DLAB FLAG
        LD      A,L                     ; LOW ORDER DIVISOR
	OUT	(UART0),A		;
	LD	A,H                     ; HIGH ORDER DIVISOR
	OUT	(UART1),A		;
UART_COMMON:    			; 0 parity, reset DLAP FLAG
        LD	A,03H
	OUT	(UART3),A		; Set 8 bit data, 1 stopbit
	LD	A,03H
	OUT	(UART4),A		; Force DTR and RTS

INITRET:
	RET