Fixed issue with UART RX and Write to flash. Changed rx char to unsigned char. this fixed it