You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Disclaimer: I don't know what I'm doing, I have very little experience with electronics and embedded development. Maybe its just a daft beginner mistake.
I'm trying to use the UART module to read in MIDI data. This is the code:
import nesper
import nesper/gpios
import nesper/timers
import nesper/uarts
app_main():
var uart_config =newUartConfig(baud_rate=31250)
var uart =newUart(uart_config, UART_NUM_2, GPIO_PIN(14), GPIO_PIN(34), buffer=1024.SzBytes)
whiletrue:
delayMillis(100)
var buff = uart.read()
if buff.len !=0:
echo buff
And it works, for a little while. After a couple of seconds (it varies), the ESP either becomes unresponsive or crashes. A backtrace from one of the crashes is here. Thanks for your help.
Edit: I was able to work around this problem by copying the nim code from read() and moving the creation of the buffer outside of the loop. Maybe the temporary buffer isn't garbage collected, or read isn't supposed to be used in a loop like this, or something else I don't quite grasp.
The text was updated successfully, but these errors were encountered:
Disclaimer: I don't know what I'm doing, I have very little experience with electronics and embedded development. Maybe its just a daft beginner mistake.
I'm trying to use the UART module to read in MIDI data. This is the code:
And it works, for a little while. After a couple of seconds (it varies), the ESP either becomes unresponsive or crashes. A backtrace from one of the crashes is here. Thanks for your help.
Edit: I was able to work around this problem by copying the nim code from
read()
and moving the creation of the buffer outside of the loop. Maybe the temporary buffer isn't garbage collected, orread
isn't supposed to be used in a loop like this, or something else I don't quite grasp.The text was updated successfully, but these errors were encountered: