You can use the GPIF done interrupt by enabling it in the GPIFIRQ register and set the endpoint in manual mode in the ISR. You can then commit the last packet with bytes lesser than 512 using INPKTEND register (additionally adding a check for the FIFO full flag). This will cause the BeginDataXfer() API to treat the last packet as a short packet and display the same number of bytes which you will mention in the length parameter. Please refer to section 10.4.6 in the Technical Reference Manual for example code in Manual mode.
I refer to your suggestion, I set the auto mode before GPIF reading, when GPIF reading is completed then set the manual mode and set INPKTEND registe.
the pc can get 4176 bytes.
Thanks for your help.