hello,
i use the spi in mode hardware , so i must configure the pin cs on the pin 15 as a chip select , but unfortunately my transfer don't work
hspi.init(baudrate=400000,sck=Pin(14), mosi=Pin(13), miso=Pin(12),firstbit=SPI.MSB )
cs.off()
hspi.write_readinto(b'\xE0\x00\x00\x00\x00\x00\x00\x00',buf)
cs.on()
but when i make the same function with Arduino C++, it works !
digitalWrite(m_ss, LOW);
m_spi.beginTransaction(SPISettings(400000, SPI_MSBFIRST, SPI_MODE0));
m_spi.transferBytes(const_cast<uint8_t*>(req.data()), resp.data(), req.size());
digitalWrite(m_ss, HIGH);
i don-t understand the problem
SPI hardware
-
- Posts: 847
- Joined: Mon Nov 20, 2017 10:18 am
Re: SPI hardware
I am not sure what port of MP your using but check if the CS pin is going low or not as the main supported method for pin control is cs.value(0) or cs.value(1)
Re: SPI hardware
Also check that the cs pin is initialized with Pin.OUT.
Re: SPI hardware
yes it is initialise and i checked with a analyser logic, it's strange
cs = Pin(15, Pin.OUT)
some parameters are not accsessible (dma channel)
With Arduino IDE, my peripheral answer to the transfert
I don't see any example in micropython except
fork
https://github.com/loboris/MicroPython_ ... o/wiki/spi
but arguments are different !
cs = Pin(15, Pin.OUT)
some parameters are not accsessible (dma channel)
With Arduino IDE, my peripheral answer to the transfert
I don't see any example in micropython except
fork
https://github.com/loboris/MicroPython_ ... o/wiki/spi
but arguments are different !
Re: SPI hardware
What do you see on the analyser? Do you see your data going out? Is the problem that you never get a result stored in buf? (How is buf initialised?)
Re: SPI hardware
i found my problem, my fpga was a response with decoded specific
thank for your reply, i finish this work, and micropython is a wonderful
programmation language
here's the simple code , i like this syntax , very clean
buf= bytearray(size)
self.hspi.init(baudrate=400000,sck=Pin(14), mosi=Pin(13), miso=Pin(12),firstbit=SPI.MSB ) # set the baudrate*
self.cs.off()
self.hspi.write_readinto(cmd,buf)
self.cs.on()
i close this post
thank for your reply, i finish this work, and micropython is a wonderful
programmation language
here's the simple code , i like this syntax , very clean
buf= bytearray(size)
self.hspi.init(baudrate=400000,sck=Pin(14), mosi=Pin(13), miso=Pin(12),firstbit=SPI.MSB ) # set the baudrate*
self.cs.off()
self.hspi.write_readinto(cmd,buf)
self.cs.on()
i close this post