I am using a transceiver TFDU4101-TR3 to communicate with another device which has exactly the same transceiver. I bought this thinking I can communicate with the transceiver using my microcontroller ATmega164PA running at 8 MHz at 3.3V. Turns out I cannot use serial without the endec which I cannot buy because of budget constraints.

So I was looking to use the RxD and TxD pins on the transceiver to somehow modulate the signal. I made my PCB ages ago and the transceiver connects to the microcontroller through RX and TX lines. Can I still modulate the signal using RX and TX pins on the micro as GPIOs?

I was looking into pulse width modulation but for that do I need to connect the transceiver pins to OCxA and OCxB pins on the micro? Can I still make do with RX and TX pins on the micro used as GPIOs and somehow use that in conjunction with PWM?


IRDA 'modulates' RS232 by converting it to/from RZI (Return to Zero Inverted). An ATmega164 running at 8MHz should be fast enough to 'bit-bang' this format on standard GPIO pins, but timing is critical so it won't be able to do much else at the same time.

You could use AVR304 (http://www.atmel.com/webdoc/atmel.docs/atmel.docs.33085.18343.html) as a starting point for your own code. Modify the Transmit code to generates a short pulse for each '0' bit, and during Receive if a pulse is detected then the bit is a '0' ('1' bits are represented by no pulse occurring during the send or receive bit time).

It might be possible to use hardware PWM for generating the transmit pulses, but I would try software timing first because it's easier (you can try other techniques once you get it working!).

RS232 to IRDA

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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