Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Issue with spi reading on the STM32-nucleo-F767ZI

Photona

Newbie
Newbie level 2
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.

1730970233685.png


1730970335675.png

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
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:

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top