Photona
Newbie
Hello,
I am trying to implement spi writing/reading to the slave device using STM32 microcontroller.
I have spi datagram define here on the page 25 that also define slave manufacture vendorID at address 0x0200.
Using below code, I tried to read vendorID and get bytearray([b'x00\x00\x00\x00']) :
Thank you for help.
I am trying to implement spi writing/reading to the slave device using STM32 microcontroller.
I have spi datagram define here on the page 25 that also define slave manufacture vendorID at address 0x0200.
Using below code, I tried to read vendorID and get bytearray([b'x00\x00\x00\x00']) :
Code:
import machine
cs = machine.Pin('SPI3_NSS', machine.Pin.OUT)
sck =machine.Pin('SPI3_SCK', machine.Pin.OUT)
mosi =machine.Pin('SPI3_MOSI', machine.Pin.OUT)
miso =machine.Pin('SPI3_MISO', machine.Pin.OUT)
spi = machine.SPI(3, baudrate=1000000, polarity=0, phase=0)
data_in = bytes(bytearray( [0x04, 0x01, 0x00, 0x00] ) ) #register 0x0200 of the slave
data_out = bytearray(4)
cs.off()
spi.write_readinto(data_in, data_out)
cs.on()
Thank you for help.