⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
11 posts / 0 new
Last post
Krixen
Offline
Last seen:3 years 9 months ago
加入:2015-09-28 16:27
IrDa Application Help

With the SDK5.0.4 I am trying to use UART2 to transmit IrDa through a IR transceiver and am having trouble setting it up.

What is the procedure? I have only changed two things:

1) Changed this line: GPIO_ConfigurePin(UART2_GPIO_PORT, UART2_TX_PIN, OUTPUT, PID_UART2_IRDA_TX, false); //changed to IRDA

2) Changed this: SetWord32(UART2_MCR_REG, UART_AFCE|UART_RTS|0x40); // |0x40 sets UART_SIRE bit to 1.

Is there anything else I need to do? Thanks!

Device:
MT_dialog
Offline
Last seen:3 months 1 day ago
Staff
加入:2015-06-08 11:34
Hi Krixen,

Hi Krixen,

Unfortunatelly there is no example in using the IrDA that i can give you as a reference although the configuration that you ve done is sufficient and you have set properly the MCR register, the rest configuration is similar the standard UART configuration, the problem with the IrDA is that the UART in the 580 has a quite significant baud rate error, so if you are trying to establish a communication you should try with lower baudrates than 115200 or even lower than 57600.

Thanks MT_dialog

Krixen
Offline
Last seen:3 years 9 months ago
加入:2015-09-28 16:27
Hello,

Hello,

Thank you for the feedback, I was out of the office for a long time and I am back.

The problem is that I see anything on the transmit line when I switch to UART IrDa. Should I still see swings of 0 to VCC, should it look like a square wave going into the transmit of the IR transceiver?

MT_dialog
Offline
Last seen:3 months 1 day ago
Staff
加入:2015-06-08 11:34
Hi Krixen,

Hi Krixen,

Yes, if you set the IrDa function you should see pulses on the TX line as long as you send data offcourse.

Thanks MT_dialog

Krixen
Offline
Last seen:3 years 9 months ago
加入:2015-09-28 16:27
Do you still use the uart

Do you still use the uart write (or printf) functions and it should spit out IrDa SIR data format? Or do I need to call some other function?

The reason I ask this is because I see nothing on my Tx line when I change the 2 registers (from the original post). It just looks like a slightly noisier line but is pretty much at 0volts always. I also see nothing on the receive side although that is expected with nothing on the Tx side.

MT_dialog
Offline
Last seen:3 months 1 day ago
Staff
加入:2015-06-08 11:34
Hi Krixen,

Hi Krixen,

No, there is no dedicated API in order to use the IrDa, with the drivers of the UART the hw is capable of operating in IrDa mode without any additional configuration. Perhaps you have misconfigured the UART itself, for example if you use any of the allready UART examples, like the uart2_async example and you make those changes (mentioned above), do you still see just 0 volts on the line and no pulses ?

Thanks MT_dialog

Krixen
Offline
Last seen:3 years 9 months ago
加入:2015-09-28 16:27
Hello again,

Hello again,

I am using common_uart.c and here are my UART settings:

// Select UART settings
#define UART2_BAUDRATE UART_BAUDRATE_115K2 // Baudrate in bits/s: {9K6, 14K4, 19K2, 28K8, 38K4, 57K6, 115K2}
#define UART2_DATALENGTH UART_CHARFORMAT_8 // Datalength in bits: {5, 6, 7, 8}
#define UART2_PARITY UART_PARITY_NONE // Parity: {UART_PARITY_NONE, UART_PARITY_EVEN, UART_PARITY_ODD}
#define UART2_STOPBITS UART_STOPBITS_1 // Stop bits: {UART_STOPBITS_1, UART_STOPBITS_2}
#define UART2_FLOWCONTROL UART_FLOWCONTROL_DISABLED // Flow control: {UART_FLOWCONTROL_DISABLED, UART_FLOWCONTROL_ENABLED}

I am using this function to print a byte at a time:

void printf_byte(char ch)
{
// print a Byte in hex format
char b;
b = ((0xF0 & ch) >> 4);
b += (b < 10) ? 48 : 55;

uart2_write((uint8_t *)&b,1, NULL);
uart2_finish_transfers();
b = (0xF & ch);
b += (b < 10) ? 48 : 55;
uart2_write((uint8_t *)&b,1, NULL);
uart2_finish_transfers();
}

I also tried activating flowcontrol but that didn't work either so I disabled it again. See anything I am missing or doing in correctly?

MT_dialog
Offline
Last seen:3 months 1 day ago
Staff
加入:2015-06-08 11:34
Hi Krixen,

Hi Krixen,

时能够看到数据打印在UART(没有rmal UART no IrDa) with the fw that you are using ?

Thanks MT_dialog

Krixen
Offline
Last seen:3 years 9 months ago
加入:2015-09-28 16:27
Yes I am able to see normal

Yes I am able to see normal UART, it is only when I switch those two registers that I do not see anything.

as a side note: Do I need flow control on?

Krixen
Offline
Last seen:3 years 9 months ago
加入:2015-09-28 16:27
Hello,

Hello,

Just checking back in to see if we can solve this. thank you

MT_dialog
Offline
Last seen:3 months 1 day ago
Staff
加入:2015-06-08 11:34
Hi Krixen,

Hi Krixen,

No you dont need to use flow control, just a regular setup of the UART (in low baud rate for the reasons mentioned above) with the corresponding bit set in order to enable the IrDa and the corresponding pins to the appropriate functionallity. If you do that and use a printing function you should see pulses (not noise) on the Tx line by using an oscilloscope, if not then i assume that there should be an electrical problem with your setup.

Thanks MT_dialog