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:
Rocco Marco Guglielmi 2019-10-23 09:28:36 +00:00
parent be28a47f11
commit 428a408f51
3 changed files with 22 additions and 13 deletions

View File

@ -33,9 +33,9 @@
<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.DEBUGGER_REGISTER_GROUPS" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;null-spi_lld_serve_interrupt-(format)&quot; val=&quot;2&quot;/&gt;&lt;content id=&quot;null-uart_init-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;null-__early_init-(format)&quot; val=&quot;0&quot;/&gt;&lt;content id=&quot;con-GP0Data-null-__early_init-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;oen-GP0Data-null-__early_init-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;pul-GP0Data-null-__early_init-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;null-sd_lld_serve_interrupt-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;null-_pal_lld_setgroupmode-(format)&quot; val=&quot;4&quot;/&gt;&lt;/contentList&gt;"/>
<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;null-spi_lld_serve_interrupt-(format)&quot; val=&quot;2&quot;/&gt;&lt;content id=&quot;null-_pal_lld_setgroupmode-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;null-sd_lld_serve_interrupt-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;pul-GP0Data-null-__early_init-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;oen-GP0Data-null-__early_init-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;con-GP0Data-null-__early_init-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;null-__early_init-(format)&quot; val=&quot;0&quot;/&gt;&lt;content id=&quot;null-uart_init-(format)&quot; val=&quot;4&quot;/&gt;&lt;/contentList&gt;"/>
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;globalVariableList/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList&gt;&#13;&#10;&lt;memoryBlockExpressionItem&gt;&#13;&#10;&lt;expression text=&quot;0x40006000&quot;/&gt;&#13;&#10;&lt;/memoryBlockExpressionItem&gt;&#13;&#10;&lt;/memoryBlockExpressionList&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="./build/ch.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="ADUCM36x-SPI"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>

View File

@ -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 = {
NULL,
@ -58,7 +58,7 @@ static THD_FUNCTION(spi_thread_1, p) {
chRegSetThreadName("SPI thread 1");
while (true) {
spiAcquireBus(&SPID1); /* Acquire ownership of the bus. */
palClearLine(LINE_LED_GREEN);
palSetLine(LINE_LED_GREEN);
spiStart(&SPID1, &hs_spicfg); /* Setup transfer parameters. */
spiSelect(&SPID1); /* Slave Select assertion. */
spiExchange(&SPID1, 512,
@ -78,7 +78,7 @@ static THD_FUNCTION(spi_thread_2, p) {
chRegSetThreadName("SPI thread 2");
while (true) {
spiAcquireBus(&SPID1); /* Acquire ownership of the bus. */
palSetLine(LINE_LED_GREEN);
palClearLine(LINE_LED_GREEN);
spiStart(&SPID1, &ls_spicfg); /* Setup transfer parameters. */
spiSelect(&SPID1); /* Slave Select assertion. */
spiExchange(&SPID1, 512,
@ -134,8 +134,6 @@ int main(void) {
* Configuring SPI GPIOs.
*/
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) |
PAL_ADUCM_PUL_PULLUP);
palSetLineMode(LINE_SPI1_MOSI, PAL_MODE_MULTIPLEXER(1) |

View File

@ -1,25 +1,36 @@
*****************************************************************************
** ChibiOS/HAL - Unified SPI driver demo. **
** ChibiOS/HAL - SPI driver demo for ARM-Cortex-M3 ADUCM360. **
*****************************************************************************
** TARGET **
The demo can be compiled to run on multiple STM32 target boards.
The demo runs on an ADICUP360 board.
** The Demo **
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 **
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:
https://launchpad.net/gcc-arm-embedded
** Notes **
Some header files used by the demo are not part of ChibiOS but are copyright of
ST Microelectronics and are licensed under a different license.
Some files used by the demo are not part of ChibiOS/RT but are copyright of
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