Hello and welcome to 2CarPros.
When you changed the crankshaft position sensor, did you happen to clear the codes or unhook the battery for a while? It's possible that the computer needs to go through a relearn procedure. The best way to get it to do so is to simply disconnect the battery for maybe fifteen minutes with the headlight switch turned on (helps drain residual power in the system quickly). Then connect the battery, turn the lights off, and start the car and let it idle for a while. It may stall or not want to idle correctly for a while, but should eventually smooth out as the computer gets acclimated to the sensors and other such things. So if you haven't done that yet, then give it a try.
Also, did you do any diagnostic testing before replacing the sensor (such as checking the wiring for shorts, etc)? I ask because a short circuit or misadjusted sensor can also cause the p0335 code. I'm going to attach AllData's instructions on diagnosing the p0335 code in the images below. Go through it and do any tests that you haven't already done. As a matter of fact, I'd suggest just doing all of it, even if you've already done some of it. It never hurts to recheck your own work.
If, after going through the procedures listed by AllData, you still have the code and symptoms, it may be that it's simply time to have the timing set replaced (timing belt, gears, guides, etc). This is normal maintenance. Hyundai calls for replacing the timing belt every 40,000 miles. If it hasn't ever been done, then go ahead and get it done ASAP. Failing to do so can cause catastrophic damage to the engine, requiring either rebuilding or replacing the engine;
I understand if you don't have all of the tools needed to go completely through AllData's diagnostic procedure (most people don't have them) so do what you can. If you can borrow an oscilloscope and/or a high end scanner with live data modes and such, then do so.
How a timing belt works:
https://www.2carpros.com/articles/how-a-timing-belt-works
Here's a nice little article on timing belts in interference engines (like yours):
https://jalopnik.com/heres-what-happens-when-your-timing-belt-snaps-and-how-1643804882
Good luck and let us know what you find. We'll go from there.
Images (Click to make bigger)
SPONSORED LINKS
Friday, February 15th, 2019 AT 5:01 AM