Hello,
I try to enable the HW-FlowControl on UART4 on a K60DN512. Therefore I use the PE Component Init_UART. After initialising the component I open the device with fopen:
MODEMUART_Init(); <= PE init function
pfile = fopen("ittye:", (pointer)(IO_SERIAL_RAW_IO | IO_SERIAL_HW_FLOW_CONTROL | IO_SERIAL_TRANSLATION | IO_SERIAL_ECHO));
ioctl(pfile, IO_IOCTL_SERIAL_SET_FLAGS, (pointer)(IO_SERIAL_RAW_IO | IO_SERIAL_HW_FLOW_CONTROL | IO_SERIAL_TRANSLATION | IO_SERIAL_ECO));
if (pfile == NULL) {
printf("Cannot open the other IO device\n");
}
for(;;){
write(pfile, "AT\n", 4);
_time_delay(1000);
}
Now I can see that there are some bits on the tx line of the UART4 but RTS and CTS lines are not working.
I found out that in the command function _kuart_polled_ioctl in the file serl_pol_kuart.c there is no implementation for the case IO_IOCTL_SERIAL_SET_HW_SIGNAL. If I understand it right there is no implementation for HW-FlowControl for a UART in MQX. Is that right?
Does anyone have an example of using HW-FlowControl on a UART?
Thanks and regards
Tobias
Added PE component settings
PUSH!
Anyone an idea?
Hello Tobias Bystricky,
this might help you, there're more posts dedicated to HW FLOW control here on the forum :
Define & control UART Signals (RTS / CTS / DTR / DTS)
Let us know :smileywink:
Regards,
MartinK
Thanks! I've tried this but it doesn't work. Do you have a full source code implementing a interrupted UART Wirth hw-flow control?
have the same issue - the solution is to add a call to setup the CTS/RTS function first in serl_pol_kuart.c (ioctl) which need to be implemented for the signal you are using - see _bsp_serial_rts_init( io_info_ptr->INIT.DEVICE ) - in you case INIT.DEVICE is 4 (UART4) - but the signal might be PTC12/PTC13 or others.
else if (*param_ptr & IO_SERIAL_HW_FLOW_CONTROL) { | |
// RTS, CTS hw flow control | |
/* get serial device index and set GPIO pin functionality to RTS */ | |
_bsp_serial_rts_init( io_info_ptr->INIT.DEVICE ); | |
sci_ptr->MODEM &= ~UART_MODEM_TXRTSE_MASK; | |
sci_ptr->MODEM |= (UART_MODEM_RXRTSE_MASK | UART_MODEM_TXCTSE_MASK); | |
} |