SPI_INT/README.md

38 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

1、功能说明
1.SPI在单线模式下使用中断发送和接收数据。
2、使用环境
软件开发环境KEIL MDK-ARM V5.34.0.0
IAR EWARM V8.50.1
硬件环境基于N32G430C8L7-STB V1.0开发
3、使用说明
/* 描述相关模块配置方法; 例如时钟、I/O 等 */
1.系统时钟128MHz
2.GPIOSPI1NSS--PA4 <--> SPI2NSS--PB12
SPI1SCK--PA5 <--> SPI2SCK--PB13
SPI1MOSI--PA7 <--> SPI2MISO--PB14
/* 描述Demo的测试步骤和现象 */
1.编译完成后,下载程序复位运行;
2. SPI1使用中断发送数据SPI2使用中断接收数据发送完成后
比较发送和接收的数据通过串口打印PASSS失败打印ERR
4、注意事项
如果使用“单线”模式主机使用的是MOSI引脚从机使用的是MISO引脚
如果CLKPOL设置为HIGH设置SPI_SCK GPIO需要设置为上拉GPIO_PULL_UP其他情况设置为下拉GPIO_PULL_DOWN
1. Function description
1. SPI uses interrupt to send and receive data in single mode.
2. Use environment
Software development environment: KEIL MDK-ARM V5.34.0.0
Hardware environment: Developed based on the evaluation board N32G430C8L7-STB V1.0
3. Instructions for use
/* Describe related module configuration methods; for example: clock, I/O, etc. */
1、SystemClock128MHz
2、GPIO:SPI1: NSS--PA4 <--> SPI2: NSS--PB12
SPI1: SCK--PA5 <--> SPI2: SCK--PB13
SPI1: MOSI--PA7 <--> SPI2: MISO--PB14
/* Describe the test steps and phenomena of the Demo */
1. After compiling, download the program to reset and run;
2. SPI1 uses interrupt to send data, SPI2 uses interrupt to receive data, after the transmission is completed,
compare the sent and received data, use the serial port to print PASSS if it passes, and print ERR if it fails;
4. Matters needing attention
The "single wire" data lines are MOSI pins on the master side and MISO pins on the slave side
If CLKPOL is HIGH, set SPI_SCK GPIO to GPIO_PULL_UP, otherwise set to GPIO_PULL_DOWN