x3.exe
Member level 1
Hi everyone,
I need to implement data flow control between PIC33 microcontroller and FT232r chip. I am using DMA feature in order to transfer data from microcontrollers RAM to UART's transmitter buffer. I know that the standard way for doing it is by assigning two microcontroller's I/O pins as CTS and RTS and controlling the data flow by asserting and deasserting them in the subroutine that writes data to TX buffer, like in this example:
void _putch (char ch)
{
while (PORTBbits.RB12 == 1) ; // wait for RTS#
while (U1STAbits.TRMT == 0) ;
U1TXREG = ch;
while (IFS0bits.U1TXIF == 0) ;
IFS0bits.U1TXIF = 0;
}
But the thing is, when using DMA for data transfer to the buffer, it is impossible to control the data flow like that ( or at least I don't know how to do it ). Can anyone please help me with that?
And one more thing I wanted to find out, what is the difference between the two settings of UxMODE.UENbits:
1)UEN=10 - UxTX, UxRX, UxCTS and UxRTS pins are enabled and used.
2)UEN=00 - UxTX and UxRX pins are enabled and used; UxCTS and UxRTS/BCLK pins controlled by port latches.
For UEN=10, if CTS and RTS are not controlled by port latches, then how are they controlled? Is it done atomatically in hardware, without the need to control them in the code?
Looking forward to your replies, thanks in advance.
I need to implement data flow control between PIC33 microcontroller and FT232r chip. I am using DMA feature in order to transfer data from microcontrollers RAM to UART's transmitter buffer. I know that the standard way for doing it is by assigning two microcontroller's I/O pins as CTS and RTS and controlling the data flow by asserting and deasserting them in the subroutine that writes data to TX buffer, like in this example:
void _putch (char ch)
{
while (PORTBbits.RB12 == 1) ; // wait for RTS#
while (U1STAbits.TRMT == 0) ;
U1TXREG = ch;
while (IFS0bits.U1TXIF == 0) ;
IFS0bits.U1TXIF = 0;
}
But the thing is, when using DMA for data transfer to the buffer, it is impossible to control the data flow like that ( or at least I don't know how to do it ). Can anyone please help me with that?
And one more thing I wanted to find out, what is the difference between the two settings of UxMODE.UENbits:
1)UEN=10 - UxTX, UxRX, UxCTS and UxRTS pins are enabled and used.
2)UEN=00 - UxTX and UxRX pins are enabled and used; UxCTS and UxRTS/BCLK pins controlled by port latches.
For UEN=10, if CTS and RTS are not controlled by port latches, then how are they controlled? Is it done atomatically in hardware, without the need to control them in the code?
Looking forward to your replies, thanks in advance.