update 1.8
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project>
|
||||
<configuration id="ilg.gnumcueclipse.managedbuild.cross.riscv.config.elf.release.1008047074" name="obj">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="795488828575321622" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
</extension>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -4,28 +4,30 @@
|
||||
* Version : V1.0.0
|
||||
* Date : 2021/06/06
|
||||
* Description : Main program body.
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
*********************************************************************************
|
||||
* Copyright (c) 2021 Nanjing Qinheng Microelectronics Co., Ltd.
|
||||
* Attention: This software (modified or not) and binary are used for
|
||||
* microcontroller manufactured by Nanjing Qinheng Microelectronics.
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
*@Note
|
||||
Hardware NSS mode, master/slave mode, data transceiver:
|
||||
Master:SPI1_NSS(PA4)\SPI1_SCK(PA5)\SPI1_MISO(PA6)\SPI1_MOSI(PA7).
|
||||
Slave:SPI1_NSS(PA4)\SPI1_SCK(PA5)\SPI1_MISO(PA6)\SPI1_MOSI(PA7).
|
||||
|
||||
This example demonstrates that in hardware NSS mode, the Master and Slave can
|
||||
transmit and receive in full duplex at the same time.
|
||||
Note: The two boards download the Master and Slave programs respectively, and
|
||||
power on at the same time.
|
||||
Hardware connection:
|
||||
PA5 -- PA5
|
||||
PA6 -- PA6
|
||||
PA7 -- PA7
|
||||
|
||||
*/
|
||||
*Hardware NSS mode, master/slave mode, data transceiver:
|
||||
*Master:SPI1_NSS(PA4)\SPI1_SCK(PA5)\SPI1_MISO(PA6)\SPI1_MOSI(PA7).
|
||||
*Slave:SPI1_NSS(PA4)\SPI1_SCK(PA5)\SPI1_MISO(PA6)\SPI1_MOSI(PA7).
|
||||
*
|
||||
*This example demonstrates that in hardware NSS mode, the Master and Slave can
|
||||
*transmit and receive in full duplex at the same time.
|
||||
*Note: The two boards download the Master and Slave programs respectively, and
|
||||
*power on at the same time.It is recommended that the NSS pin be connected to
|
||||
*a 10K pull-up resistor.
|
||||
* Hardware connection:
|
||||
* PA4 -- PA4
|
||||
* PA5 -- PA5
|
||||
* PA6 -- PA6
|
||||
* PA7 -- PA7
|
||||
*
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include "string.h"
|
||||
@@ -64,7 +66,8 @@ void SPI_FullDuplex_Init(void)
|
||||
|
||||
#if(SPI_MODE == HOST_MODE)
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
|
||||
@@ -99,6 +102,11 @@ void SPI_FullDuplex_Init(void)
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
|
||||
#endif
|
||||
|
||||
#if(SPI_MODE == HOST_MODE)
|
||||
SPI_SSOutputCmd(SPI1, ENABLE);
|
||||
|
||||
#endif
|
||||
|
||||
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
|
||||
@@ -120,8 +128,6 @@ void SPI_FullDuplex_Init(void)
|
||||
SPI_InitStructure.SPI_CRCPolynomial = 7;
|
||||
SPI_Init(SPI1, &SPI_InitStructure);
|
||||
|
||||
SPI_SSOutputCmd(SPI1, DISABLE);
|
||||
|
||||
SPI_Cmd(SPI1, ENABLE);
|
||||
}
|
||||
|
||||
@@ -138,9 +144,11 @@ int main(void)
|
||||
u8 j = 0;
|
||||
u8 value;
|
||||
|
||||
SystemCoreClockUpdate();
|
||||
Delay_Init();
|
||||
USART_Printf_Init(460800);
|
||||
printf("SystemClk:%d\r\n", SystemCoreClock);
|
||||
printf( "ChipID:%08x\r\n", DBGMCU_GetCHIPID() );
|
||||
|
||||
#if(SPI_MODE == SLAVE_MODE)
|
||||
printf("Slave Mode\r\n");
|
||||
|
||||
Reference in New Issue
Block a user