Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 29, 2005 20:22:25

Mike Y.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Butterfly RS232?


Looking at the schematic for the Butterfly, it's not readily apparent how itmanages to translate levels for outbound data. The docs seem to say it'ssupposed to work, but my primitive understanding of electronics matches theresults: non-receipt of "transmitted" data. It could also be my primitiveunderstanding of the mega169's usart that's at fault. Is the ported gccButterfly usart code supposed to work?Many thanks.
Mike.



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#2 Nov. 29, 2005 21:19:19

Joerg W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Butterfly RS232?


"Mike Young" <> wrote:

> Looking at the schematic for the Butterfly, it's not readily
> apparent how it manages to translate levels for outbound data.

Well, it's a bit tricky, but it can be seen.

The incoming RxD is normally held at negative level by the external
transmitter (i.e. the PC). This negative potential is used to charge
a capacitor (1 µF) via a Schottky diode. The butterfly's transmitter
uses the stored charge as a negative bias to produce its own negative
level on output.

Of course, this is a bit tricky and cannot guarantee enough negative
level to match the RS-232 or V.28 specs (in particular not if the
sender sends signals with a lot of positive bits), but then, most PCs
these days don't care as they only use a single +5 V supply for the
receiver side, so 0 V on input (which is in V.28's "undefined range")
would normally be considered to be like a negative input voltage
anyway.

--
cheers, J"org .-.-. --... ...-- -.. . DL8DTLhttp://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#3 Nov. 30, 2005 00:37:45

Mike Y.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Butterfly RS232?


Thanks. The pin is completely dead when I probe it with a scope. It canhardly be hardware in this day and age. Right?The gcc-port code looks as follows. Connection settings on the PC are 19200,8N1, no handshake. Receive works just fine, else I wouldn't be bothering youwith it. I know for certain the code gets to the _Tx function when itshould. It hits breakpoints in the debugger, and I've added that annoyingPlayClick in the callers.void USART_Init(unsigned int baudrate)

{

// Set baud rate

UBRRH = (unsigned char)(baudrate>>8);

UBRRL = (unsigned char)baudrate;

// Enable 2x speed

UCSRA = (1<<U2X);

// Enable receiver

UCSRB = (1<<RXEN)|(0<<TXEN)|(0<<RXCIE)|(0<<UDRIE);

// Async. mode, 8N1

UCSRC = (0<<UMSEL)|(0<<UPM0)|(0<<USBS)|(3<<UCSZ0)|(0<<UCPOL);

}



void Usart_Tx(char data)

{

while (!(UCSRA & (1<<UDRE)));

UDR = data;

}

char Usart_Rx(void)

{

while (!(UCSRA & (1<<RXC)));

return UDR;

}----- Original Message -----From: "Steve Franks" <>To: "'Mike Young'" <>
Sent: Tuesday, November 29, 2005 5:50 PM
Subject: RE: Butterfly RS232?Mike,I've done it, seems to work fine for me. Hooked up DB9 directly to thepinson the butterfly. Will try to remember to send code when home this eve.

Steve-----Original Message-----
From: Mike Young
Sent: Tuesday, November 29, 2005 1:15 PM
To: avr-gcc-l***@*ongnu.org
Subject: Butterfly RS232?


Looking at the schematic for the Butterfly, it's not readily
apparent how it
manages to translate levels for outbound data. The docs seem
to say it's
supposed to work, but my primitive understanding of
electronics matches the
results: non-receipt of "transmitted" data. It could also be
my primitive
understanding of the mega169's usart that's at fault. Is the
ported gcc
Butterfly usart code supposed to work?

Many thanks.
Mike._______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#4 Nov. 30, 2005 01:06:57

Daniel O.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Butterfly RS232?


On Wed, 30 Nov 2005 10:54, Mike Young wrote:
> // Set baud rate
>
> UBRRH = (unsigned char)(baudrate>>8);
>
> UBRRL = (unsigned char)baudrate;
>
> // Enable 2x speed
>
> UCSRA = (1<<U2X);
>
> // Enable receiver
>
> UCSRB = (1<<RXEN)|(0<<TXEN)|(0<<RXCIE)|(0<<UDRIE);

This line turns the transmitter off..
I'm not sure why you have 0<<TXEN and others. I would write it as..
UCSRB = _BV(RXEN);

> // Async. mode, 8N1
>
> UCSRC = (0<<UMSEL)|(0<<UPM0)|(0<<USBS)|(3<<UCSZ0)|(0<<UCPOL);

This line has the same issue as the previous one, plus if you actually want to
modify UCSRC and not UBRRH (they are at the same address - at least on
ATMega32's) you need to set the MSB (URSEL), eg

UCSRC = _BV(URSEL) | _BV(UCSZ0) | _BV(UCSZ1);



--
Daniel O'Connor software and network engineer
for Genesis Software -http://www.gsoft.com.au"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8CpgpmPlqYhOAo2.pgpDescription:PGP signature_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Attachments:
attachment pgpmPlqYhOAo2.pgp (187 bytes)

Offline

#5 Nov. 30, 2005 02:29:02

Mike Y.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] Butterfly RS232?


#if 0
// Enable receiver
UCSRB = (1<<RXEN)|(0<<TXEN)|(0<<RXCIE)|(0<<UDRIE);
#else
// Enable receiver AND transmitter
UCSRB = (1<<RXEN)|(1<<TXEN)|(0<<RXCIE)|(0<<UDRIE);
#endif

It works a treat. Thanks.----- Original Message -----From: "Daniel O'Connor" <>To: <avr-gcc-l***@*ongnu.org>Cc: "Mike Young" <>; "Steve Franks"<>Sent: Tuesday, November 29, 2005 6:57 PM
Subject: Re: Butterfly RS232?




_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

Board footer

Moderator control

Enjoy the 22nd of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support