[Tiva TM4C123] UART write succeeds but throws OSError 116

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
ExXec
Posts: 43
Joined: Sat Oct 20, 2018 4:02 pm

[Tiva TM4C123] UART write succeeds but throws OSError 116

Post by ExXec » Mon Apr 15, 2019 2:20 pm

Hey,

can someone tell me, where the errno 116 can be issued in the call stack for UART?
I can't find the line.

I didn't find this error code in the errno table, but I read in another post, that this is a timeout error.

I'm having trouble getting it to work, it successfully sends the data but shows

Code: Select all

>>> uart.write('hallo')                                                         
Traceback (most recent call last):                                              
  File "<stdin>", in <module>                                                   
OSError: 116
This only happens with free running code, if I step manually from stream.c:233 it works just fine.


Thanks,

-ExXec

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

Re: [Tiva TM4C123] UART write succeeds but throws OSError 116

Post by dhylands » Mon Apr 15, 2019 2:49 pm

OSError 116 is ETIMEDOUT.

For the pyboard, there are 2 places:
https://github.com/micropython/micropyt ... art.c#L676
https://github.com/micropython/micropyt ... art.c#L696

Both in the uart_tx_data function. This could be flow control related, or the timeout specified when the UART was opened is too small for the baud rate?

It could also happen if HAL_GetTick isn't accurate since that's how the UART determines if the timeout has expired or not.

ExXec
Posts: 43
Joined: Sat Oct 20, 2018 4:02 pm

Re: [Tiva TM4C123] UART write succeeds but throws OSError 116

Post by ExXec » Mon Apr 15, 2019 3:00 pm

Ah, I see.
This is really strange, because my IDE says MP_ETIMEDOUT is defined as 110.
So I got confused where 116 is coming from.

Thank you!

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

Re: [Tiva TM4C123] UART write succeeds but throws OSError 116

Post by dhylands » Mon Apr 15, 2019 3:24 pm

mperrno.h has 2 sets of error codes depending on how MICROPY_USE_INTERNAL_ERRNO is set i your mpconfigport.h

The pyboard has MICROPY_USE_INTERNAL_ERRNO set to 1 which would make MP_ETIMEDOUT be 110. But if it's not defined or set to zero, the MP_ETIMEDOUT will be set to ETIMEDOUT which comes from toolchain errno.h. For ARM, ETIMEDOUT is 116.

Post Reply