5234 - eTPU & RS422
Re: 5234 - eTPU & RS422
Regarding half duplex 485, how about a max13487e/max13488e which includes auto sensing of direction, would those make it a bit easier for half duplex?
Re: 5234 - eTPU & RS422
Hi there, nice find... Pity they are +5V operation only. My current design is +3.3V only
If your design has 5V available and you are going to use the eTPU then these will save you a lot of extra code and IO for swithcing the transmitter on and off.
I'll look at these for the next designs though! Just need to add a +5V supply next time as they don't have these in +3.3V.
Dave...
If your design has 5V available and you are going to use the eTPU then these will save you a lot of extra code and IO for swithcing the transmitter on and off.
I'll look at these for the next designs though! Just need to add a +5V supply next time as they don't have these in +3.3V.
Dave...
Re: 5234 - eTPU & RS422
My idea of trying the following does not work.
while (eTPU->chan[TX_CHANNEL].scr.b.cis == 0)
{
/* wait for data to transmit */
}
It is ZERO on entry and there is still bytes going out of the serial port so my TX disable of the RS485 driver was
If I delay the TX being disabled after transmitting I get the data back from the Modbus driver but as the reply can be any length, this delay method is not ideal and I want to simply switch from TX to RX after the last byte has been transmitted.
I need to look through all the code and documents for the eTPU and see how to detect when the buffer is empty.
I think the auto enabled RS485 drivers you found will avoid this issue for you.
Cheers,
Dave...
while (eTPU->chan[TX_CHANNEL].scr.b.cis == 0)
{
/* wait for data to transmit */
}
It is ZERO on entry and there is still bytes going out of the serial port so my TX disable of the RS485 driver was
If I delay the TX being disabled after transmitting I get the data back from the Modbus driver but as the reply can be any length, this delay method is not ideal and I want to simply switch from TX to RX after the last byte has been transmitted.
I need to look through all the code and documents for the eTPU and see how to detect when the buffer is empty.
I think the auto enabled RS485 drivers you found will avoid this issue for you.
Cheers,
Dave...
Re: 5234 - eTPU & RS422
Btw, here is some calculations for eTPU on how many uarts (and baudrate) that can be access at the same time...
http://www.freescale.com/files/training ... E_ETPU.pdf
Cheers
http://www.freescale.com/files/training ... E_ETPU.pdf
Cheers
Re: 5234 - eTPU & RS422
Nice find. Looks like my next project with 8 eTPU UARTs running at a max of 19200 each is going to work just fine.
Cheers,
Dave...
Cheers,
Dave...
Re: 5234 - eTPU & RS422
Hey RG, I got the half duplex code working. I use a PC application called Simply Modbus Master to test it and using the following code after sending via the eTPU.
With this I can detect the buffer being empty and then switch back to receive. No lost bytes
while(! eTPURec[eTPUchannel].FIFO.Empty());
eTPUchannel is the channel for the transmit line.
After this I then have a small delay based on 1.5 bit times before I disable the TX driver and it works very well.
Dave...
With this I can detect the buffer being empty and then switch back to receive. No lost bytes
while(! eTPURec[eTPUchannel].FIFO.Empty());
eTPUchannel is the channel for the transmit line.
After this I then have a small delay based on 1.5 bit times before I disable the TX driver and it works very well.
Dave...
-
- Posts: 513
- Joined: Sat Apr 26, 2008 7:14 am
Re: 5234 - eTPU & RS422
Very cool. I am assuming you use a hw timer, probbaly the PIT to do the delay? If so, do you use a separate PIT timer for each '485 channel so each channel can run independently? I doubt you'd want to stack up the channels to share one timer...?
Re: 5234 - eTPU & RS422
Yes, I am using a PIT for the timing. I have only gotten the Modbus slave port to work and next I will do the Modbus Master next. I am therefore only using a single timer for now. As I have a common Modbus library I am looking at how to have it use a different timer.
As the speeds can be different on both Modbus ports, I am going to need a different timer for each one.
Tomorrow I will complete the code to do the Modbus master and fingers crossed it will work without any issues.
Cheers,
Dave...
As the speeds can be different on both Modbus ports, I am going to need a different timer for each one.
Tomorrow I will complete the code to do the Modbus master and fingers crossed it will work without any issues.
Cheers,
Dave...