Discussion in "ARM Development" started by    diana1234    Mar 30, 2014.
Sun Mar 30 2014, 11:39 pm
#1
Hello sir,
I am using LPC2478 MCU and interfaced it for 485 serial communication, for this i am using IC MAX485. my controller is working on 3.3volts and i gave 5v supply to MAX485.
Here i faced some problem in serial communication, data transmitt is ok when i dont controll the EN pin of MAX485. but when i set a I/O for controlling the EN pin of MAX485, there are no transmission nor receive occurs, it shows only 0xff as receiveing any data. and when I remove the I/O configuration from my programm, it gets normal in transmission. at this time there is only transmission occurs bcs the EN pin of MAX485 remains in logic High state.
The compiler I am using is Keil-U4-MDK4.71

please suggest me, what can i do.
Thanx in advance

Mon Mar 31 2014, 12:44 pm
#2
Can you post your MAX485 circuit diagram? I want to see how you've connected it. also post the code snippet for GPIO control.
Mon Mar 31 2014, 03:14 pm
#3
Thanks ajay sir for replying,
Here, i've attached the RS485 code part and schmatic part, please find it

Thank you once again


Attachment
Mon Mar 31 2014, 10:22 pm
#4
Try to use this way...

void trans2(char ch2)
{
    IOSET0 =0x00200000; // max=1 P0.21
    U2THR=ch2;
    while(!(U2LSR & 0x20));
    IOCLR0 =0x00200000;     //max=0
}
 diana1234 like this.
Tue Apr 01 2014, 04:19 pm
#5
@ Ajay sir, thanx for replying

i just tried this but the things are same as before.
only 0xFF is transmitting and receive.

could there any delay problem in switching that EN pin via P0.21 or any other thing else.
Wed Apr 02 2014, 10:16 am
#6
yes put some minor delay before and after sending data. you can put a simple for loop delay.
Wed Apr 02 2014, 10:35 am
#7
@ajay sir
yes i have put some delay. like

void trans2(char ch2)
{
unsigned char i;

IOSET0 =0x00200000; // max=1 P0.21

for(i=0;i<100;i++);
U2THR=ch2;
while(!(U2LSR & 0x20));
for(i=0;i<100;i++);

IOCLR0 =0x00200000; //max=0
}



but nothing is happens.
the exact situation is i am transmitting "INDIA" in while(1) loop every sec, but the data received is I N D I 0xff
on receiving section only 0xFF is received.
Wed Apr 02 2014, 11:01 am
#8


I am using LPC2478 MCU and interfaced it for 485 serial communication, for this i am using IC MAX485. my controller is working on 3.3volts and i gave 5v supply to MAX485.

diana1234


You might have a logic level mis-match.
Try using a transistor and pull- up resister to match the levels.

Will the MAX485 run on 3.3 volts ?
Wed Apr 02 2014, 11:22 am
#9
@ ExperimaenterUK, Thanks for your reply

no, MAX485 supply voltage is 4.75V < Vcc <5.25V
so I have given it a 5V at Vcc.

Also this controller's pins are 5V tolarable, thats why i use 5V on this IC only on Vcc pin as you can see in attached schmatic.
After that; is there possibility for level mismatching?

Thanks in advance
Wed Apr 02 2014, 12:08 pm
#10
are you using FIFO mode in LPC uart? coz it may be possible that 2 byte deep fifo is causing this issue? after sending last byte you move out of the loop disabling MAX485 tx. Try disabling FIFO mode if its enabled by any chance. I do not feel voltage level is an issue here.. just check Vih and Vil of Max485 from datasheet.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Astorne
Tue Apr 16 2024, 08:52 pm
Williamjaf
Tue Apr 16 2024, 12:25 pm
best_yyPa
Tue Apr 16 2024, 09:42 am
ErnestoExpop
Tue Apr 16 2024, 02:57 am
Jamesclepe
Mon Apr 15 2024, 11:10 am
Aliciaelora
Mon Apr 15 2024, 07:59 am
btaletvpcu
Mon Apr 15 2024, 04:36 am
UbvpwcTib
Mon Apr 15 2024, 03:13 am