-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
Description
Likely DMA race condition. Chunking the data into 500 sized chunks and sleeping between the writes fixes the issue.
package main
import (
"machine"
"strconv"
"time"
)
func main() {
time.Sleep(2 * time.Second) // connect via serial
buf1 := makeBuffer('|', 600)
buf2 := makeBuffer('/', 600)
println("start")
serialWrite(buf1)
serialWrite(buf2)
}
func makeBuffer(sep byte, size int) []byte {
buf := make([]byte, size)
for i := 0; i < size-5; i += 5 {
buf[i] = sep
strconv.AppendInt(buf[i+1:i+1:i+5], int64(i), 10)
}
return buf
}
func serialWrite(b []byte) {
machine.Serial.Write(b)
}Got
tinygo flash -target=pico -scheduler=tasks -monitor ./examples/pico-bug
Connected to /dev/ttyACM0. Press Ctrl-C to exit.
s505|510|515|520|525|530|535|540|545|550|555|560|56580/485/490/495/500/505/510/515/520/525/530/535/540/545/550/555/560/565/570/575/580/585/590/100/105/110/115/120/125/130/135/140/145/150/155/160/165/170/175/180/185/190/195/200/205/210/215/220/225/230/235/240/245/250/255/260/265/270/275/280/285/290/295/300/305/310/315/320/325/330/335/340/345/350/355/360/365/370/375/380/385/390/395/400/405/410/415/420/425/430/435/440/445/450/455/460/465/470/475/480/485/490/495/500/505/510/515/520/525/530/535/540/545/550/555/560/565/570/575/580/585/590/100/105/110/115/120/125/130/135/140/145/150/155/160/165/170/175/180/185/190/195/200/205/210/215/220/225/230/235/240/245/250/255/260/265/270/275/280/285/290/295/300/305/310/315/320/325/330/335/340/345/350/355/360/365/370/375/380/385/390/395/400/405/410/415/420/425/430/435/440/445/450/455/460/465/470/475/480/485/490/495/500/505/510/515/520/525/530/535/540/545/550/555/560/565/570/575/580/585/590
Expected
start
|0|5|10|15|20|25|30|35|40|45|50|55|60|65|70|75|80|85|90|95|100|105|110|115|120|125|130|135|140|145|150|155|160|165|170|175|180|185|190|195|200|205|210|215|220|225|230|235|240|245|250|255|260|265|270|275|280|285|290|295|300|305|310|315|320|325|330|335|340|345|350|355|360|365|370|375|380|385|390|395|400|405|410|415|420|425|430|435|440|445|450|455|460|465|470|475|480|485|490|495|500|505|510|515|520|525|530|535|540|545|550|555|560|565|570|575|580|585|590
/0/5/10/15/20/25/30/35/40/45/50/55/60/65/70/75/80/85/90/95/100/105/110/115/120/125/130/135/140/145/150/155/160/165/170/175/180/185/190/195/200/205/210/215/220/225/230/235/240/245/250/255/260/265/270/275/280/285/290/295/300/305/310/315/320/325/330/335/340/345/350/355/360/365/370/375/380/385/390/395/400/405/410/415/420/425/430/435/440/445/450/455/460/465/470/475/480/485/490/495/500/505/510/515/520/525/530/535/540/545/550/555/560/565/570/575/580/585/590
Reactions are currently unavailable