2
\$\begingroup\$

I am using an Arduino to program an ATTiny like in this tutorial. My question is:

How can i send data to my computer on the serial port? Is it possible ?

Any ideas are welcome.

\$\endgroup\$
0

3 Answers 3

2
\$\begingroup\$

Neither the ATTiny45 (parameters overview) nor the ATTiny85 (parameters overview) has a UART, which makes it a bit painful to connect them directly to a computer.

If they had a UART a common procedure would be to use a USB to serial adapter, preferably with TTL voltage levels (5V or 3.3V) and use the UART in the chip directly.

In your case it's not as easy as you don't have a UART. They do have both SPI and I2C though so you can make them talk through the Arduino as it has both SPI/I2C and UART support. Another alternative is to use an "USB to SPI/I2C" dongle, but they're not really that easy to use (and not what you're after).

Edit: Another solution proposed by @AndrejaKo is to implement the UART in software. If you're only sending this can be quite easy as you only need to get the timing right and can just bang out the bits from there.

\$\endgroup\$
3
  • 5
    \$\begingroup\$ Why would software UART be a big problem? \$\endgroup\$
    – AndrejaKo
    Commented Feb 4, 2012 at 20:19
  • \$\begingroup\$ can i use this device instead of the FTDI Cable ? robofun.ro/ftdi_basic_5v?keyword=FTDI&category_id=0 if yes witch is the best version to use 3.3 V or 5 V ? \$\endgroup\$
    – opc0de
    Commented Feb 5, 2012 at 10:07
  • \$\begingroup\$ That more or less is a FTDI cable (it has a FTDI chip on it), so yes that has the right interface. If you need the 3.3V or 5V version depend on what you're using for your chip. Get version that has the the same voltage as your ATTiny. \$\endgroup\$ Commented Feb 5, 2012 at 11:38
2
\$\begingroup\$

The ATTiny 45/85 doesnt have a hardware UART but it does have a USI (Universal Serial Interface) hardware module that simplifies implementing a UART in software.

Atmel have an appnote explaining this. Some USI example source here

for a working example that doesn't use USI, have a look at this one on AVRFreaks Full Duplex SW-UART with FIFO - you might need to login to AVRFreaks view that page.

Note however that you will probably need a level converter to match rs232 voltages on the pc.

A simple alternative might be to bitbang low speed usb on the ATTiny85 using the V-USB library, but that will consume significant amounts of your processors program memory and clock cycles.

\$\endgroup\$
1
\$\begingroup\$

I had some success using a CP2102 based USB-UART adapter. I used atmega32 which has hadware UART, but it should also work with a software UART. I think that almost any USB to UART converter would be fine.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.