[En-Nut-Discussion] Ethernut 2, RS485 on UART1

Douglas Pearless Douglas.Pearless at pearless.co.nz
Tue Nov 9 10:22:13 CET 2004


Hmm,

I have got a little further, reading the nut library code.

I think this is on the right track?

    NutRegisterDevice(&devUart1, 0, 0);
    uart1 = fopen("uart1", "r+b");
    _ioctl(_fileno(uart1), UART_SETSPEED, &vertigo_baud);
	_ioctl(_fileno(uart1), USART_MF_HALFDUPLEX, &something);

BUT what should &something point to? How do I get it to toggle PD5?

How can I use the ioctl to set / reset the MPCM bit in UART1 to enable /
disable the address vs data mode???

Any ideas?

Douglas

-----Original Message-----
From: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] On Behalf Of Douglas Pearless
Sent: Monday, 8 November 2004 8:22 p.m.
To: Douglas.Pearless at pearless.co.nz; 'Ethernut User Chat (English)'
Subject: RE: [En-Nut-Discussion] Ethernut 2, RS485 on UART1

I forgot to add, I use addressing (MPCM bit) to send 1 address byte and then
1 command byte and then 0 to 4 data bytes, depending on the command.
It seems as though only the address byte sometimes gets through, other
times, the address byte is repeated the same number of times as the total
number of bytes I send from the ATMega16, weird.

Douglas

-----Original Message-----
From: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] On Behalf Of Douglas Pearless
Sent: Monday, 8 November 2004 8:14 p.m.
To: 'Ethernut User Chat (English)'
Subject: [En-Nut-Discussion] Ethernut 2, RS485 on UART1

Hi,

Has anyone got some code that works for this???

I have an Ethernut talking to a ATMega16.  My raw code on the ATMega16
transmits the data correctly, but the Ethernut seems to get a bit messed up.

I have tried to understand how the NUT/IS handles it (read usart1avr.c,
usuartavr.c. uart.h etc) but can't quite get it to work.

Does anyone have some sample code I can review to assist with my
understanding?

HELP!

Douglas 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 1/11/2004
 

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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 1/11/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 1/11/2004
 

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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 1/11/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.791 / Virus Database: 535 - Release Date: 8/11/2004
 




More information about the En-Nut-Discussion mailing list