I've been working with the freedom bootloader on the FRDM-K64F board (UART1), and all worked well. I've now changed the FRDM board to my custom board (the RX,TX pins of the freedom_bootloader code did not change, as in the FRDM board I also changed to UART1 and it worked fine). I'm working with half duplex RS485.
I cannot connect with the KinetisFlashTool. I'm guessing the reason is my custom board is working with half duplex RS485. As such, I need to enable the RTS of the chip, just as I did with my application on this board:
UART1->MODEM |= UART_MODEM_TXRTSPOL(1);
UART1->MODEM |= UART_MODEM_TXRTSE(1);
My problem is I don't know where to put these 2 lines in the freedom_bootloader code. If placed in the wrong place (I guess before the UART is init) there's a hard fault.
I've found this function: scuart_poll_for_activity, but don't know if this is the correct place.
When I click 'Connect' in the GUI of Kinetis FLash Tool, there's an autoBaudRate function which get interrupted, in which the baud rate is calculated (counts the transitions of some signal, I guess), then it goes to the UART configuarion function.
In my board the autoBaudRate function is not called, which leads me to the conclusion it is somehow connected to the RS485 half duplex issue?