AW: [En-Nut-Discussion] UART_SETCLOCKMODE - UART_NSYNCSLAVE

Ernst Stippl ernst at stippl.org
Tue Sep 12 07:16:24 CEST 2006


Hi Dave! 

which compiler/version did you use then and do you use now. in GCC defines
changed regarding how interrupts are nemed, etc. maybe hvae a look in that
direction.

regards
ernst

-----Ursprüngliche Nachricht-----
Von: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von Dave Smart
Gesendet: Montag, 11. September 2006 13:59
An: 'Ethernut User Chat (English)'
Betreff: [En-Nut-Discussion] UART_SETCLOCKMODE - UART_NSYNCSLAVE

After searching the archives, I couldn't find the help I need. So, I hope
someone in this forum has been down this road before me.

I'm trying to use synchronous mode to receive data from a PC keyboard. I had
this working in early 2003 (before sync mode was natively supported), but
now I'm trying again with the latest tool chain. Hardware is an Ethernut 2.

It seems that whether I use UART_NSYNCSLAVE or UART_SYNCSLAVE, the data I
receive is always the same (as if that setting isn't working). Any ideas?

// Initialization
	FILE * uartkybd;
	int rlen = 0;
	u_long _ioctlParam;			// one parameter to save
stack frame
	
	// Sync UART Interface to PC Keyboard, which will retrieve Scan
Codes
	rlen = NutRegisterDevice(&devUart1, 0, 0);	// open the UART as
a stream
	uartkybd = fopen("uart1", "r+b");

      // Replace the standard Rx ISR with our custom version to do Scancodes
	rlen = NutRegisterIrqHandler(&sig_UART1_RECV, CustomRxComplete,
&devUart1);
	_ioctlParam = UART_NSYNCSLAVE;	// tx on rising edge, rx on falling
edge
	_ioctl(_fileno(uartkybd), UART_SETCLOCKMODE, &_ioctlParam);
	_ioctlParam = 2;
	_ioctl(_fileno(uartkybd), UART_SETPARITY, &_ioctlParam);
	_ioctlParam = 1;
	_ioctl(_fileno(uartkybd), UART_SETSTOPBITS, &_ioctlParam);
	_ioctlParam = 8;
	_ioctl(_fileno(uartkybd), UART_SETDATABITS, &_ioctlParam);
	// doesn't work here either
	//_ioctlParam = UART_NSYNCSLAVE;	// tx on rising edge, rx on
falling edge
	//_ioctl(_fileno(uartkybd), UART_SETCLOCKMODE, &_ioctlParam); ...



static void CustomRxComplete(void *arg)
	{
	u_char data;
	static prog_char hexonly_fmt[] = "UDR: %02X\n";

#ifdef UDR1
    if(dev->dev_base)
        data = inp(UDR1);
    else
#endif
        data = inp(UDR);

	printf_P(hexonly_fmt, data);
...



Kind regards,
Dave Smart 

_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion



--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.2/442 - Release Date: 08.09.2006



-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.3/445 - Release Date: 11.09.2006





More information about the En-Nut-Discussion mailing list