From 428a408f51eb29dda14e23d090bac92151c05b9f Mon Sep 17 00:00:00 2001 From: Rocco Marco Guglielmi Date: Wed, 23 Oct 2019 09:28:36 +0000 Subject: [PATCH] Improved SPI demo for ADuCM360 git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13141 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- ...UCM36x-SPI (OpenOCD, Flash and Run).launch | 4 ++-- testhal/ADUCM/SPI/main.c | 8 +++---- testhal/ADUCM/SPI/readme.txt | 23 ++++++++++++++----- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/testhal/ADUCM/SPI/debug/ADUCM36x-SPI (OpenOCD, Flash and Run).launch b/testhal/ADUCM/SPI/debug/ADUCM36x-SPI (OpenOCD, Flash and Run).launch index 53fa53602..e5e8f6cb5 100644 --- a/testhal/ADUCM/SPI/debug/ADUCM36x-SPI (OpenOCD, Flash and Run).launch +++ b/testhal/ADUCM/SPI/debug/ADUCM36x-SPI (OpenOCD, Flash and Run).launch @@ -33,9 +33,9 @@ - + - + diff --git a/testhal/ADUCM/SPI/main.c b/testhal/ADUCM/SPI/main.c index 777392006..7ebedc2fe 100644 --- a/testhal/ADUCM/SPI/main.c +++ b/testhal/ADUCM/SPI/main.c @@ -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) | diff --git a/testhal/ADUCM/SPI/readme.txt b/testhal/ADUCM/SPI/readme.txt index 22a6b515b..a07ad094f 100644 --- a/testhal/ADUCM/SPI/readme.txt +++ b/testhal/ADUCM/SPI/readme.txt @@ -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 \ No newline at end of file