Issue with spi reading on the STM32-nucleo-F767ZI

Photona

Newbie
Joined
Nov 7, 2024
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
10
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']) :


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.
 

Attachments

  • OIF-HB-CDM-02.0.pdf
    1.2 MB · Views: 4

Hi,

No error description, no question... no schematic

What do you expect us to do?

Klaus
 

Hello Klaus,

Thank you for your reply.

I do not have errors in micropython.

But responce from SPI is b'\x00\x00\x00\x00' and I expect to get reading from the specified register (0x0200) 0xE0CF.

I want to have confirmation that micropython code that I use is correct and I use correct phase and polarity.

What information do you need? I am happy to provide more info.
 
Last edited:

Cookies are required to use this site. You must accept them to continue using the site. Learn more…