random uart.write oserror 116

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
EasyRider
Posts: 94
Joined: Wed Dec 30, 2015 8:17 am

random uart.write oserror 116

Post by EasyRider » Wed Jan 06, 2016 10:05 pm

Have been getting very few random oserror 116 (timeout?) with uart.write(bytearray(message)) in while loop with delay(200), uart = UART(1, 38400) , after continuous operation 12-24 hours.

message is a 15 byte integer buffer.

There is no uart connection or handshaking involved, so uart.write is just a free run, and generally works OK for about 12 hours of continuous running.

Hardware STM32F407 , firmware stm32f4disc-2016-01-05-v1.5.2-25-g67f40fb.dfu.

I haven't ruled out the hardware, will try another board soon.

Is there any possibility in micropython to look at?

Regards
John

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: random uart.write oserror 116

Post by pythoncoder » Thu Jan 07, 2016 8:00 am

I'll try it on a Pyboard and report back tomorrow (I don't have a Discovery board).
Peter Hinch
Index to my micropython libraries.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: random uart.write oserror 116

Post by pythoncoder » Fri Jan 08, 2016 7:13 am

Still going strong 22 hours in. I'll let it run until tomorrow, but I suspect it's specific either to the Discovery or to your actual hardware.
Peter Hinch
Index to my micropython libraries.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: random uart.write oserror 116

Post by dhylands » Fri Jan 08, 2016 7:37 am

I don't understand how you can get a timeout error on a uart write except if your timeout is shorter than the amount of time it takes for the bits to actually be transmitted,

I suppose if flow control was happening then that could delay things and cause a timeout.

EasyRider
Posts: 94
Joined: Wed Dec 30, 2015 8:17 am

Re: random uart.write oserror 116

Post by EasyRider » Fri Jan 08, 2016 8:34 am

I don't understand how you can get a timeout error on a uart write except if your timeout is shorter than the amount of time it takes for the bits to actually be transmitted,

I suppose if flow control was happening then that could delay things and cause a timeout.
Apart from from some other processing code and a loop delay(200), I did have 2 lines of printing the same "message" to a PC terminal.

Have run same code for just over 24 hours on one of newly arrived pyboards with pybv11-2016-01-06-v1.5.2-25-g67f40fb.dfu firmware.

No issues, will keep testing on both pyboard and discovery.

Have not seen a function yet for a WDT (Watch dog timer) for pyboard STMF405.

Is there a WDT function or should it be implemented by setting appropriate registers for a particular controller?

Regards
John

EasyRider
Posts: 94
Joined: Wed Dec 30, 2015 8:17 am

Re: random uart.write oserror 116

Post by EasyRider » Fri Jan 08, 2016 8:31 pm

Apology for asking about WDT, should have searched more, newbie impatience syndrome :oops:
http://micropython.org/resources/docs/e ... b.WDT.html

Had uart.write oserror 116 generated while I was doing some other stuff on the PC.

Don't know if it has something to do with REPL connection, did not actually directly interact with REPL at the time ?

Regards
John

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: random uart.write oserror 116

Post by dhylands » Fri Jan 08, 2016 9:03 pm

What might be happening is that the USB Mass Storage handler could be causing a flash block to be written. SInce that code runs from an interrupt, it will cause the main thread to suspend. If the time taken to write the flash block is longer than the timeout then that could cause the timeout that you're seeing.

If you use a longer timeout (or no timeout) then the writes will still happen, but there may a gap between the characters where the flash write occurred.

EasyRider
Posts: 94
Joined: Wed Dec 30, 2015 8:17 am

Re: random uart.write oserror 116

Post by EasyRider » Fri Jan 08, 2016 10:28 pm

Thanks Dave,

You are most likely correct.

I will completely disconnect from PC and run as stand alone with uart.write only, to reflect actual embedded application.

Regards
John

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: random uart.write oserror 116

Post by pythoncoder » Sat Jan 09, 2016 5:23 am

My test on the Pyboard ran faultlessly for 44 hours so I shut it down. I hope you solve your problem.
Peter Hinch
Index to my micropython libraries.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: random uart.write oserror 116

Post by pythoncoder » Sat Jan 09, 2016 6:04 am

EasyRider wrote:Is there a WDT function or should it be implemented by setting appropriate registers for a particular controller?
The WDT is implemented for the WiPy but not for the Pyboard as far as I can see. I have some code here https://github.com/peterhinch/micropython-samples.git which enables its use on the Pyboard.
Peter Hinch
Index to my micropython libraries.

Post Reply