Problem using Flex Full board and RS485 module

Forum related to the FLEX boards

Moderator: paolo.gai

erikadds
Newbie
Posts: 45
Joined: Wed May 12, 2010 9:41 am

Re: Problem using Flex Full board and RS485 module

Post by erikadds » Wed Mar 21, 2012 3:48 pm

Hi,
if the UART interrupt doesn't occur maybe is because the CPU interrupts are disabled.
If you call ENTER_CRITICAL_SECTION you disable all interrutps.
If this is not the problem, check with a simpler code how UART interrupts work and then retry with your application code.

I hope this is helpful.
Thanks.

DDS

moonckim
Newbie
Posts: 15
Joined: Fri Feb 04, 2011 9:18 pm

Re: Problem using Flex Full board and RS485 module

Post by moonckim » Thu Mar 22, 2012 5:39 pm

I figured out why the TX interrupt did not occur. What happened was the following: Once TX INT was disabled "after" TX completion, I needed to write a byte to U2TXREG before re-enabling the TX INT.

Another problem I have is mode switch in RS485. Now my master can send bytes to slave periodically and my slave is programmed to echo back the byte stream it received from the master. However, the master does not receive it. Is there any timing issues to switch between ENABLE
PORTFbits.RF12 = 0;
PORTFbits.RF13 = 1;
and DISABLE
PORTFbits.RF12 = 0;
PORTFbits.RF13 = 0;

Once the slave receives a predefined number of bytes, it "ENABLEs" the UART2 port for RS485. Then, it echos back those bytes received. At the end of tx, it "DISABLEs" the port. However, the master does not receive the echo-back bytes, and the slave does no longer receive any additional bytes after the mode change-and-back. Any comments or suggestions?

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re: Problem using Flex Full board and RS485 module

Post by paolo.gai » Thu May 10, 2012 11:07 am

Hi, sorry for the delay in the answer.

It seems more a problem of programming the Serial peripheral than about ERIKA or the board itself... I guess one place to look at could be the demos provided by microchip. Also the Errata for the specific microcontroller usually helps... I do not think it is anything related to the rs485, probably the same thing appears also with rs232...

PJ

Locked