STM32F4Dis Board using with Cygwin - SPI


 

SPI对应的Pin:

micropython-1.12\ports\stm32\boards\STM32F4DISC

mpconfigboard.h 


// SPI busses
#define MICROPY_HW_SPI1_NSS  (pin_A4)
#define MICROPY_HW_SPI1_SCK  (pin_A5)
#define MICROPY_HW_SPI1_MISO (pin_A6)
#define MICROPY_HW_SPI1_MOSI (pin_A7)
#define MICROPY_HW_SPI2_NSS  (pin_B12)
#define MICROPY_HW_SPI2_SCK  (pin_B13)
#define MICROPY_HW_SPI2_MISO (pin_B14)
#define MICROPY_HW_SPI2_MOSI (pin_B15)

 

 

 

 

SPI bus

See pyb.SPI.

REF http://docs.micropython.org/en/latest/library/pyb.SPI.html#pyb-spi

from pyb import SPI

spi = SPI(1, SPI.MASTER, baudrate=200000, polarity=1, phase=0)
spi.send('hello')
spi.recv(5) # receive 5 bytes on the bus
spi.send_recv('hello') # send and receive 5 bytes

 

 

 

SPI 原理

REF:

 

 

 

你可能感兴趣的:(STM32F4Dis Board using with Cygwin - SPI)