I hate to drag out an old post, but I don't think it's really worth starting a new one for what I have to add.
This code can be caused by someone starting the truck with either:
1. a key with a dead battery in the fob
2. a copy key without a fob at all
3. a key with the incorrect fob
I had a spare key made by a key shop. It's just a plain key; no fob for the security system. I hide the "real" spare key in my cab somewhere only I know. That way, if I loose my key, I have a spare plain key hidden outside the truck so I can get in but that if anyone else finds it, they won't be able to steal my truck. I can then retrieve my "real" key from it's secret hiding place and drive my truck. I tried the spare key and it will start my truck, then it dies almost immediately. Just the way it's supposed to work! Yea! Then I checked the codes and the P0513 came up one time. Rechecking, the code would never duplicate itself. However, if I used the spare key again, the one without the security fob on it, then the code came back. It is possible that someone tried to start your truck without the proper security fob attached to the key.
BTW, anyone ever been successful trying to program a spare security key? There's a procedure in my owner manual. I got a key off eBay and tried to program it according to the manual, but was unsuccessful. Good thing I only paid $5 for it I guess...