Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[General] TSOP38438 interfaced with USCI Uart in IrDA mode error

Status
Not open for further replies.

Manasu24

Newbie level 3
Newbie level 3
Joined
Jan 7, 2015
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
Banglore-27
Visit site
Activity points
28
here i am using TSOP ir receiver directly to the USCI UART port rxd pin.and it is producing the output as FF continuously for all commands.
link to data sheet
www.vishay.com/docs/82491/tsop382.pdf
link to microcontroller
www.ti.com/lit/ds/symlink/msp430f5438.pdf

code i am using:
Code:
void irda_init(void)
{
		UCA1CTL1 |= UCSWRST;
		UCA1CTL0 |= 0x00;
		UCA1CTL1 |= UCSSEL__SMCLK + UCSWRST;
		UCA1MCTL |= UCBRF_0  + UCBRS_7 + UCOS16;
		UCA1STAT &= ~UCLISTEN;
		UCA1IRTCTL |= UCIRTXPL5 + UCIRTXCLK + UCIREN ;
		UCA1IRRCTL |= UCIRRXFL5 + UCIRRXPL;// + UCIRRXFE;
		UCA1CTL1 &= ~UCSWRST;
		UCA1IE |= UCRXIE;
}
void hwi_irda(void)
{
	_DINT();
	System_printf("IRDATA = %d\t %x\t %c\n",UCA1RXBUF,UCA1RXBUF,UCA1RXBUF);
	System_flush();
	_EINT();
}

the concept i am using here is:
-> Configuring the UART into IrDA mode.
-> Uart in IrDA mode have capability to decode the IR signals and fed decoded data in RX Buffer of UART.
but here in my case it is giving FF for all commands and signals whatever i am sending.

so please clarify me how to use this Ir receiver and Msp430 to get particular data i am sending.

Thanks in Advance
 
Last edited by a moderator:

I am not sure about your referred controller coding.I did use IrDA mode for msp430f2274.It is working.hope that might help you.

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "msp430x22x4.h"
 
unsigned char RxByte;
unsigned char TxByte;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
DCOCTL = CALDCO_8MHZ; // Load 8MHz constants
BCSCTL1 = CALBC1_8MHZ;
P3SEL |= 0x30; // Use P3.4/P3.5 for
USCI_A0
P1OUT &= ~0x01; // Clear P1.0
P1DIR |= 0x01; // P1.0 output
UCA0CTL0 =0x00;
UCA0CTL1 |= UCSWRST; // Set SW Reset
UCA0CTL1 = UCSSEL_2 + UCSWRST;
UCA0BR0 = 4; // Baudrate = 115200 Hz
UCA0BR1 = 0;
UCA0MCTL = UCBRS_5 + UCBRF_3 + UCOS16;
UCA0IRTCTL = UCIRTXPL2 + UCIRTXPL0 + UCIRTXCLK + UCIREN;
// Pulse length = 6 half clock cyc
// Enable BITCLK16, IrDAenc/dec
UCA0IRRCTL = UCIRRXPL; // Light = low pulse
UCA0CTL1 &= ~UCSWRST; // Resume operation
IE2 |= UCA0RXIE; // Enable RX int
while (1)
{
__disable_interrupt();
IE2 |= UCA0RXIE; // Enable RX int
__bis_SR_register(CPUOFF + GIE); // Enter LPM0 w/interrupts
 
if ('p' == RxByte) // RX OK?
{
P1OUT |= 0x01; // LED P1.0 on
while (!(IFG2 & UCA0TXIFG)); // Ensure TX buffer is ready
UCA0TXBUF = RxByte; // Move RX'd character to USCI_A0
P1OUT &= ~0x01; // Clear P1.0
 
}
}
}
 
//--------------------------------
----------
// Read RXed character from USCI_A0, return from LPM0
//--------------------------------
----------
#pragma vector = USCIAB0RX_VECTOR
__interrupt void USCIAB0RX_ISR(void)
{
RxByte = UCA0RXBUF; // Get RXed character
IE2 &= ~UCA0RXIE; // Disable RX int
__bic_SR_register_on_exit(CPUOFF); // Return active after
receiption
}



Please check your pin initialization.
 
I never heard that a RC receiver could be used for IrDA. Or IrDA UART for RC decoding. Please correct me if I'm wrong.
 

no sorry you are right sir I didn't refer the IR data sheet in post.My mistake..
 
The TSOP IR receivers expect a modulated signal. IRDA uses unmodulated transmissions.

You need IR Tx/Rx modules to be connected to the motherboard. I'm not sure those would be easy to get anymore. You could build one yourself using IR diodes and detectors, there are schematics available on the web.

Here's one, for example. **broken link removed**

Regards.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top