Skip to content

stm32f407 uart can't receive data #4896

Open
@RockyF

Description

@RockyF
h1 = &machine.UART{
	Buffer:            machine.NewRingBuffer(),
	Bus:               stm32.USART3,
	TxAltFuncSelector: machine.AF7_USART1_2_3,
	RxAltFuncSelector: machine.AF7_USART1_2_3,
}

h1.Configure(machine.UARTConfig{
	BaudRate: 115200,
	TX:       machine.PB10,
	RX:       machine.PB11,
})

buffer := make([]byte, 16)
for {
	n, _ := h1.Read(buffer)
	if n > 0 {
		println("got", n)
	} else {
		h1.Write([]byte("aaa\r\n"))
	}
	time.Sleep(time.Millisecond * 1000)
}

Serial monitor print 'aaa' and send 'bbb' per second.
but mcu can't receive any data.

Why? Is code correct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about usage of TinyGostm32

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions