I'm having problems uploading sketches to my custom arduino uno design. I have a ttl to usb based on the ch340 and at the same time I have a RS485 transcriber both conected to the atmega328 serial port, since I know I can't use both devices at the same time I added a jumper (J11) to enable or disable the RS485 part of the circuit when I want to upload sketches or use the USB port to debug my code, following the arduino uno design I added two 1K resistor in series on the RX and TX (R29 and R30) see https://electronics.stackexchange.com/a/213167/123482 so the RS485 takes preference over the USB when selected with the jumpers.
I have tracked down the issue to my USB part of the design, if R15 and R16 are 320k like on my schematic the arduino IDE can't upload code to the board, avrdude timeouts, if I change the resistor values from 320K to 1K most of the times the upload works as expected but fails when it tries to read back the flash memory, if I remove the resistors it always work as expected. Obviously the problem is there but why?
Note: Added 328 pinout