-
Notifications
You must be signed in to change notification settings - Fork 997
atsamd5x: improve USBCDC #1481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
atsamd5x: improve USBCDC #1481
Conversation
|
The reason why it is set to draft is that we need to merge the interp-rewrite branches to be able to build. I tested it with the following code with WioTerminal. package main
import (
"fmt"
"machine"
"time"
)
var buf = [1024 * 10]byte{}
var (
debugPort1 = machine.BCM3
)
func main() {
debugPort1.Configure(machine.PinConfig{Mode: machine.PinOutput})
for i := range buf {
if ((i + 1) & 0x0F) == 0 {
buf[i] = byte(fmt.Sprintf("%X", byte(i>>4)&0xF)[0])
} else {
buf[i] = '.'
}
}
buf[0] = '+'
for {
debugPort1.High()
machine.UART0.Write(buf[:1024*10])
//machine.UART0.Write(buf[:1024])
machine.UART0.Write([]byte("\r\n"))
//fmt.Printf("hello world\r\n")
//println("hello world")
debugPort1.Low()
time.Sleep(time.Second)
}
} |
|
89002b6 to
15ccc47
Compare
|
It is buildable on the current dev branch so it is ready for review. I wish I could make the implementation more straightforward, but I can't think of a good way to do it right now. The code for testing can be found at I checked it on Windows 10 and found the following
|
|
The code does appear to work. I made a few comments about using @aykevl do you have any feedback? |
|
Updated. @deadprogram |
|
Made a few small comments @sago35 that look like we can shorten by a couple of lines of code. |
|
Updated. @deadprogram I thought USBCDC.Flush() should not be changed. |
|
I think this is now fine how it is. @sago35 can you please squash into a single commit? Thank you! |
eefd589 to
1a202f4
Compare
|
squashed. @deadprogram |
|
This is really great, thank you for working on it @sago35 just waiting for CI to finish to merge. Now we just need the same thing for SAMD21! 😸 |
|
I will prepare the samd21 version as well. |
The following approaches were used to speed up the process.
Unlike #1452, it does not require additional memory.
The code is a little more complicated, but it looks like it works very well.
interrupt.Disable()cannot be built unless interp-rewrite is merged.Samd2x can be made faster in the same way.
Once we have reviewed this PR, we will create a PR.