attiny13 rs232

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
simisv
Flowcode v5 User
Posts: 24
Joined: Wed Jun 06, 2012 11:52 am
Location: London
Has thanked: 5 times
Contact:

attiny13 rs232

Post by simisv »

hi

i am using rs232 on attiny13 , 9.6mhz , 3Volt , and is not working .
i dont now how to solve the problem.

thank you
Attachments
tiny13test.fcf_avr
(6.5 KiB) Downloaded 316 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: attiny13 rs232

Post by Benj »

Hello,

Have you got a LED on your application you can flash at say 1hz to confirm that your Flowcode setup is correct for the hardware? Once you have confirmed delays are ok on the hardware you can be pretty sure that the RS232 baud rate is being calculated correctly.

simisv
Flowcode v5 User
Posts: 24
Joined: Wed Jun 06, 2012 11:52 am
Location: London
Has thanked: 5 times
Contact:

Re: attiny13 rs232

Post by simisv »

hi
thank you for response
i have 3 led's on outputs and all tested with 1sec delay flash and all ok
serial port not working

simisv
Flowcode v5 User
Posts: 24
Joined: Wed Jun 06, 2012 11:52 am
Location: London
Has thanked: 5 times
Contact:

Re: attiny13 rs232

Post by simisv »

now i tested tx send data and i receive strange caracters on pc terminal
tested with diferent baudrate and receive rong data on pc terminal

simisv
Flowcode v5 User
Posts: 24
Joined: Wed Jun 06, 2012 11:52 am
Location: London
Has thanked: 5 times
Contact:

Re: attiny13 rs232

Post by simisv »

rs232 custom baudrate settings not working

simisv
Flowcode v5 User
Posts: 24
Joined: Wed Jun 06, 2012 11:52 am
Location: London
Has thanked: 5 times
Contact:

Re: attiny13 rs232

Post by simisv »

Hi

No one knows a solution to my problem? :?:

Thank you

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: attiny13 rs232

Post by Benj »

Hello,

My guess is that the baud rate for the software UART is slightly off which is why you are not receiving any data.

There are several posts on the forum regarding tweaking the baud of the software UART connection.

The first thing I would do is probably transmit the byte value 0x55 over the RS232 in a loop and use a scope to check the bit timings of the signal. Is this something you are able to do?

simisv
Flowcode v5 User
Posts: 24
Joined: Wed Jun 06, 2012 11:52 am
Location: London
Has thanked: 5 times
Contact:

Re: attiny13 rs232

Post by simisv »

Hi
I dont have a scope , only multimeter .

simisv
Flowcode v5 User
Posts: 24
Joined: Wed Jun 06, 2012 11:52 am
Location: London
Has thanked: 5 times
Contact:

Re: attiny13 rs232

Post by simisv »

hi

i found a posible problem on this project
i tested the attiny13 rs232 with external clock 8mhz and is working ok
how can i solve the internal clock problem ???

thank you

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: attiny13 rs232

Post by Benj »

Hello,

My guess is that the internal clock is off slightly which means your software baud is slightly off.

Have a look at the output C code file from Flowcode and search for this line.

#define %m_SW_BAUD %r

%m will be the component instance eg RS232_1 and%r will be a numeric value.

Then go to the component customisation and edit the defines code function.

Again find the line

#define %m_SW_BAUD %r

and this time replace the %r with the numeric value from the output C code file.

Adjust this number up and down slightly and fingers crossed you will find a value that allows the baud to work correctly on your device.

There may be another way which is to tune the internal oscillator but i'm not 100% how and even if this is possible on the ATTiny devices.

simisv
Flowcode v5 User
Posts: 24
Joined: Wed Jun 06, 2012 11:52 am
Location: London
Has thanked: 5 times
Contact:

Re: attiny13 rs232

Post by simisv »

hi Benj

thank you for your response
i found the value for rs232 but is ok only with sending data ,
the Rx is not whorking
This value can be different for different attiny13 ?

i will keep the external oscillator , is better for me .

Thank you

Post Reply