SHWotever / SimHub

Multi sim dashboard, bass shaker driver, ....
http://www.simhubdash.com/
799 stars 98 forks source link

SimHUB: Arduino randomly resets #675

Closed CristianoBesi closed 4 years ago

CristianoBesi commented 4 years ago

Good day

I purchased a wheel with a built-in Arduino TW2812 with 16 RGB LEDs, which is linked to SimHUB installed on the PC through a USB 3.0 wire.

Every now and then, mostly when playing ACC, it resets and stops working for a second.

The most common error is the following, despite it seems hard it can force the Arduino to reset, even because it happens even with f1 2020, even if way less frequently, but it might depend on the display that calls such variable.

ERROR - Unhandled dispatcher errorSystem.MissingFieldException: Field not found: 'EnsiFerrum.ACCSharedMemory.Data.Graphics.clock'. at EnsiFerrum.ACCCDS.EnsiFerrum_ACCCDS_Graphics.Acc_GraphicsUpdated(Object sender, UpdateEventArgs e) at System.EventHandler1.Invoke(Object sender, TEventArgs e) at EnsiFerrum.ACCSharedMemory.ACCSM.OnUpdated(UpdateEventArgs e) at EnsiFerrum.ACCSharedMemory.ACCSM.<>c__DisplayClass36_01.b__0(Object obj) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

The most significant log file seems to be the attached one. Every 10 mins, after few errors and mostly after every lap, the game disconnects, and it connects after half a second.

Can anybody help me out on this?

Thanks in advance

SimHub.log

SHWotever commented 4 years ago

Hi ! I see indeed that the screen is disconnecting regularly (it's a nextion screen right ?) If the screen resets it would make me think about a powering issue, i'm not sure about the dash you are using but it probably uses a new lap screen, when the nextion switch the screen it draws more power, I would check the usb cable, avoid usb hub if any, and make sure the jumper is soldered on the arduino if you are using one.

About the 0.5s delay on new lap it's probably related to the statistics being computed on new laps (there are a lot, lap record, map record, delta computations etc ...,, history storage etc...) but it should not trigger a reset only a small delay.

Nicolas

CristianoBesi commented 4 years ago

Thanks a lot for the answer, Nicolas.

Yes, it is a NX4827T043_11 (Basic Nextion 4.3" screen). It is connected directly to a USB 3.0 port (switched plenty, same problem) and uses a separate 5v-2A Power Supply. According to the producer, it should be enough for any power requests.

I've even changed the USB 3.0 wire, but it didn't solve the problem :(

CristianoBesi commented 4 years ago

By the way, the screen doesn't flash or turn off. I can hear the sound of a USB disconnection (like I plugged off the wheel) and an immediate reconnection afterwards. The software resets and it goes back to the idle screen. Therefore it seems more an Arduino issue than a display one. (Check the attached video, if you like)

Are you aware of some settings that might help?

Thanks a lot

Reset.zip

SHWotever commented 4 years ago

Ah thanks for that info, so it confirms that it's an hardware/Arduino issue, in theory 2amps is far enough indeed.

Do you have some hardware around which could cause parasites (EMI) ?

If somehow you are using a custom sketch to add more buttons/encoders I would try to replace it with default sketch to see if the issue still occurs, on an Arduino pro micro if a crash occurs it may simply reset. The standard sketch is left unchanged for a very long time so I doubt there is an issue here, but if you are using a custom one it's worth checking.

CristianoBesi commented 4 years ago

Now that you mentioned it, the device is mounted on a Thrustmaster TX motor (which gives vibrations, of course). Do you think that the transformer inside might be causing EMIs? Because, in fact, I plugged out the wheel and tested it through a benchmark, with basically no issues, even if I tried to move and shackle it.

And right recently, when the wheel started to give problems (didn't happen for months), the transformer within the motor broke and a trimmer burned (which is the most common issue on Trhustmaster motors)

There are 12 buttons and 6 rotary encoders, so there might be a custom sketch. Not sure because I didn't built it.

So It shouldn't depend on the telemetry, right?

SHWotever commented 4 years ago

With vibrations is would simply think about a failing solder, it's the most classic issue, and would explain that brutal usb disconnect

About the 0.5s delay it's different and related to telemetry indeed (new lap) you can reduce this effect by resetting the lap history database : delete the C:\Program Files (x86)\SimHub\PluginsData{game}\datastore.db (ie : C:\Program Files (x86)\SimHub\PluginsData\AssettoCorsaCompetizione\datastore.db), but in all cases it stays lot of computations during the new lap event which must be done, you can make it a little faster by raising simhub process priority in simhub settings.

CristianoBesi commented 4 years ago

Thanks a lot!

You have been precious