1˵

	1SPI жϷͺͽ

2ʹû

    KEIL MDK-ARM V5.34.0.0
    Ӳ 
        N32G05xϵУ
            N32G05xRBQ7_STB V1.0
        N32G05xϵУ
            N32G05xRBL7_STB V1.0


3ʹ˵
	
    1ʱԴHSE+PLL
    2ʱӣ64MHz
    3SPI1 ã
            SCK   -->  PB12
            MOSI  -->  PB10
            ģʽ
            ģʽ
            8bit
            ԣʼΪ/ڶ
            Ƭѡ
            ǰMSB
    
    4SPI2 ã
            SCK   -->  PC0
            MISO  -->  PC3
            ģʽ
            ģʽ
            8bit
            ԣʼΪ/ڶ
            Ƭѡ
            ǰMSB

	5жϣSPI1 жں SPI1_IRQHandlerSPI2 жں SPI2_IRQHandler
    6ʹ÷
        /* DemoĲԲ */
        1.سλУ
        2.SPI1 Ҫʱ SPI1_IRQHandler жϺͣSPI2 Ҫʱ SPI2_IRQHandlerжϺգݴɺ󣬲鿴 TransferStatus ״̬Ϊ PASSED

4ע
	1. ߡ豸ΪMOSIţڴ豸ΪMISO
    2. ģʽ£ʱӿеƽCLKŵ/



1. Function description

	1. SPI single-wire interrupt sending and receiving data

2. Use environment
	Software development environment: KEIL MDK-ARM V5.34.0.0
    Hardware development environment:
         N32G05x series:
            Developed based on the evaluation board N32G05xRBQ7_STB V1.0
         N32G05x series:
            Developed based on the evaluation board N32G05xRBL7_STB V1.0

3. Instructions for use

	/* Describe related module configuration methods; for example: clock, I/O, etc. */
	1. SystemClock: 64MHz
    2. clock source:HSE+PLL

    3. SPI1 configuration:
        SCK   -->  PB12
        MOSI  -->  PB10
    	single-line
    	Master mode
    	8 bit transmission
    	Polarity: start at low/second edge
    	Piece of software to choose
    	Big end in front MSB

    4. SPI2 Configuration:
        SCK   -->  PC0 
        MISO  -->  PC3
    	single-line
    	Slave mode
    	8 bit transmission
    	Polarity: start at low/second edge
    	Piece of software to choose
    	Big end in front MSB
	5. Interrupt: SPI1 interrupt entry function SPI1_IRQHandler, SPI2 interrupt entry function SPI2_IRQHandler

	/* Describe the test steps and phenomena of the Demo */
	1. After compiling, download the program to reset and run;
	2. Enter the SPI1_IRQHandler interrupt function to send when SPI1 has data to send, 
	   and enter the SPI2_IRQHandler interrupt function to receive when SPI2 has data to receive. 
	   After the data transmission is completed, check the TransferStatus status as PASSED;

4. Matters needing attention
	1. The "single wire" data lines are MOSI pins on the master side and MISO pins on the slave side.
    2. In single-wire mode, the pull-up/down of the host CLK pin should be configured according to the idle level of the host clock.