[En-Nut-Discussion] UART_SETCLOCKMODE - UART_NSYNCSLAVE
Dave Smart
Dave at Smart-Family.net
Thu Sep 14 13:54:07 CEST 2006
That's a good question ernst, for which I wish I had the answer. My
configuration management practices weren't as good then as I hope they are
now. I kept my sources - but didn't properly archive the tool chain that I
used. My practice is to ride near the leading edge until my work is nearly
done, then stop the upgrades, so whatever was "current" at the time. [I was
using NutOs 3.32 as near I can tell]
In my upgrade, I'm using the latest gcc from winavr, and NutOs 4.<latest
stable>.
So, I'm tearing down my program to the basics, trying to get this feature to
work again. I've fairly meticulously diffed the nutos from then to now and
thought I was properly accounting for the changes.
I'm at the stage when a simple [and known working] example from anyone would
be welcome!
Regards,
Dave
-----Original Message-----
From: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] On Behalf Of Ernst Stippl
Sent: Tuesday, September 12, 2006 12:16 AM
To: 'Ethernut User Chat (English)'
Subject: AW: [En-Nut-Discussion] UART_SETCLOCKMODE - UART_NSYNCSLAVE
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
_______________________________________________
En-Nut-Discussion mailing list
En-Nut-Discussion at egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
More information about the En-Nut-Discussion
mailing list