A loose gas cap is not going to set an EGR code so more than likely you have an issue with the EGR. I would remove it and inspect it and if it were me, I would just replace it.
Here is a guide that will with testing it if you would like to do this:
Below is the info for the EGR from the manual. Let's run through this info and let us know if you have other questions. Thanks
Images (Click to enlarge)
Friday, May 21st, 2021 AT 1:19 PM