Improved SPI demo for ADuCM360
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13141 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
be28a47f11
commit
428a408f51
|
@ -33,9 +33,9 @@
|
||||||
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
|
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
|
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?><contentList><content id="null-spi_lld_serve_interrupt-(format)" val="2"/><content id="null-uart_init-(format)" val="4"/><content id="null-__early_init-(format)" val="0"/><content id="con-GP0Data-null-__early_init-(format)" val="4"/><content id="oen-GP0Data-null-__early_init-(format)" val="4"/><content id="pul-GP0Data-null-__early_init-(format)" val="4"/><content id="null-sd_lld_serve_interrupt-(format)" val="4"/><content id="null-_pal_lld_setgroupmode-(format)" val="4"/></contentList>"/>
|
<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?><contentList><content id="null-spi_lld_serve_interrupt-(format)" val="2"/><content id="null-_pal_lld_setgroupmode-(format)" val="4"/><content id="null-sd_lld_serve_interrupt-(format)" val="4"/><content id="pul-GP0Data-null-__early_init-(format)" val="4"/><content id="oen-GP0Data-null-__early_init-(format)" val="4"/><content id="con-GP0Data-null-__early_init-(format)" val="4"/><content id="null-__early_init-(format)" val="0"/><content id="null-uart_init-(format)" val="4"/></contentList>"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <globalVariableList/> "/>
|
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <globalVariableList/> "/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList/> "/>
|
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList> <memoryBlockExpressionItem> <expression text="0x40006000"/> </memoryBlockExpressionItem> </memoryBlockExpressionList> "/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="./build/ch.elf"/>
|
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="./build/ch.elf"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="ADUCM36x-SPI"/>
|
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="ADUCM36x-SPI"/>
|
||||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
|
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
|
||||||
|
|
|
@ -39,7 +39,7 @@ const SPIConfig hs_spicfg = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Low speed SPI configuration (62.500kHz, CPHA=0, CPOL=0, MSb first).
|
* Low speed SPI configuration (16MHz/256, CPHA=1, CPOL=1, MSb first).
|
||||||
*/
|
*/
|
||||||
const SPIConfig ls_spicfg = {
|
const SPIConfig ls_spicfg = {
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -58,7 +58,7 @@ static THD_FUNCTION(spi_thread_1, p) {
|
||||||
chRegSetThreadName("SPI thread 1");
|
chRegSetThreadName("SPI thread 1");
|
||||||
while (true) {
|
while (true) {
|
||||||
spiAcquireBus(&SPID1); /* Acquire ownership of the bus. */
|
spiAcquireBus(&SPID1); /* Acquire ownership of the bus. */
|
||||||
palClearLine(LINE_LED_GREEN);
|
palSetLine(LINE_LED_GREEN);
|
||||||
spiStart(&SPID1, &hs_spicfg); /* Setup transfer parameters. */
|
spiStart(&SPID1, &hs_spicfg); /* Setup transfer parameters. */
|
||||||
spiSelect(&SPID1); /* Slave Select assertion. */
|
spiSelect(&SPID1); /* Slave Select assertion. */
|
||||||
spiExchange(&SPID1, 512,
|
spiExchange(&SPID1, 512,
|
||||||
|
@ -78,7 +78,7 @@ static THD_FUNCTION(spi_thread_2, p) {
|
||||||
chRegSetThreadName("SPI thread 2");
|
chRegSetThreadName("SPI thread 2");
|
||||||
while (true) {
|
while (true) {
|
||||||
spiAcquireBus(&SPID1); /* Acquire ownership of the bus. */
|
spiAcquireBus(&SPID1); /* Acquire ownership of the bus. */
|
||||||
palSetLine(LINE_LED_GREEN);
|
palClearLine(LINE_LED_GREEN);
|
||||||
spiStart(&SPID1, &ls_spicfg); /* Setup transfer parameters. */
|
spiStart(&SPID1, &ls_spicfg); /* Setup transfer parameters. */
|
||||||
spiSelect(&SPID1); /* Slave Select assertion. */
|
spiSelect(&SPID1); /* Slave Select assertion. */
|
||||||
spiExchange(&SPID1, 512,
|
spiExchange(&SPID1, 512,
|
||||||
|
@ -134,8 +134,6 @@ int main(void) {
|
||||||
* Configuring SPI GPIOs.
|
* Configuring SPI GPIOs.
|
||||||
*/
|
*/
|
||||||
palSetLineMode(LINE_SPI1_CS, PAL_MODE_OUTPUT_PUSHPULL);
|
palSetLineMode(LINE_SPI1_CS, PAL_MODE_OUTPUT_PUSHPULL);
|
||||||
palSetLineMode(LINE_SPI1_MISO, PAL_MODE_MULTIPLEXER(1) |
|
|
||||||
PAL_ADUCM_PUL_PULLUP);
|
|
||||||
palSetLineMode(LINE_SPI1_MISO, PAL_MODE_MULTIPLEXER(1) |
|
palSetLineMode(LINE_SPI1_MISO, PAL_MODE_MULTIPLEXER(1) |
|
||||||
PAL_ADUCM_PUL_PULLUP);
|
PAL_ADUCM_PUL_PULLUP);
|
||||||
palSetLineMode(LINE_SPI1_MOSI, PAL_MODE_MULTIPLEXER(1) |
|
palSetLineMode(LINE_SPI1_MOSI, PAL_MODE_MULTIPLEXER(1) |
|
||||||
|
|
|
@ -1,25 +1,36 @@
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
** ChibiOS/HAL - Unified SPI driver demo. **
|
** ChibiOS/HAL - SPI driver demo for ARM-Cortex-M3 ADUCM360. **
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
|
|
||||||
** TARGET **
|
** TARGET **
|
||||||
|
|
||||||
The demo can be compiled to run on multiple STM32 target boards.
|
The demo runs on an ADICUP360 board.
|
||||||
|
|
||||||
** The Demo **
|
** The Demo **
|
||||||
|
|
||||||
The application demonstrates the use of the HAL SPI driver.
|
The application demonstrates the use of the HAL SPI driver.
|
||||||
|
|
||||||
|
** Board setup **
|
||||||
|
|
||||||
|
To redirect P0.1 and P0.2 to the SPI connector it is required to setup
|
||||||
|
the switch matrix as:
|
||||||
|
- S1 -> 0
|
||||||
|
You should than connect P0.0 and P0.2 togheter (MISO1 and MOSI1 from the
|
||||||
|
P7 connector): this would guarantee the loopback connection.
|
||||||
|
|
||||||
** Build Procedure **
|
** Build Procedure **
|
||||||
|
|
||||||
The command "make" builds the demo for all targets. The demo can be compiled
|
The command "make" builds the demo for the target. The demo can be compiled
|
||||||
using the "GNU ARM Embedded Toolchain" from:
|
using the "GNU ARM Embedded Toolchain" from:
|
||||||
|
|
||||||
https://launchpad.net/gcc-arm-embedded
|
https://launchpad.net/gcc-arm-embedded
|
||||||
|
|
||||||
** Notes **
|
** Notes **
|
||||||
|
|
||||||
Some header files used by the demo are not part of ChibiOS but are copyright of
|
Some files used by the demo are not part of ChibiOS/RT but are copyright of
|
||||||
ST Microelectronics and are licensed under a different license.
|
Analog Devices and are licensed under a different license.
|
||||||
|
Also note that not all the files present within the Analog Devices
|
||||||
|
Cross Core Embedded Studio are distributed with ChibiOS/RT,
|
||||||
|
you can find the whole library on the ADI web site:
|
||||||
|
|
||||||
http://www.st.com
|
http://www.analog.com
|
Loading…
Reference in New Issue