another thing to note on the 2xk40 ,4xK40 , is that usart 2 default pins share the ISCP pins
although notes on PBP3.1.1 for the k40 indicate a possible ISCP lockout can occur , i have not had this happen
what i have found is that while programing using iscp , with the terminal port connected , which also provides alt power to my device , the device driver for the usb to ttl chip can occasionally hang the pc while the ISCP is programing
so i would recommend allocating other pins for usart2 when designing with k40 , if you ever need the ISCP port ,
the k40 PPS port make it nice to do this
charles recommends in the notes
RX2 = RB5 on 2xk40, 4x40
TX2 = RB4 on 2xk40 , 4xk40
DEFINE HSER2_RXREG PORTB
DEFINE HSER2_RXBIT 5
DEFINE HSER2_TXREG PORTB
DEFINE HSER2_TXBIT 4
cheers
Sheldon
Bookmarks