EasyManuals Logo

Globalstar ST150 User Manual

Globalstar ST150
73 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #25 background imageLoading...
Page #25 background image
9150-0125-01 R-4
ST150M User Manual
Confidential & Proprietary Information
25
The basic steps in setting up an additional SPI instance is as follows:
o
You will need 4 pins for MOSI, MISO, CLK and CS. If you plan to drive multiple SPI Slave devices off of the same
master device instance, you will need an additional pin for each additional CS line, and your HAL will be more
complex than the example in the Globalstar ST150 SDK.
o
Remove the 4 (or more) pins you plan to use from the GPIO list in UAPI_GPIO_list.c. Note that the pin definition
constants that you are setting below will reserve those pins for your SPI port via the GPIO library when the
initialization function for your new library is called, if the initialization function retains the lines of code that reserve
the pins from the original template.
o
Make a copy the source file “GSTAR_HAL_spi_1.c” and add the new file to the project. A recommended name is
“GSTAR_HAL_spi_n.c” where “n” is the instance number that you are using.
o
Edit the new file to change the instance number to the one desired (e. g. “2”).
o
In “GSTAR_HAL_spi.h” copy the block below:
#define SPI_1_CLK_PIN 12 //28
#define SPI_1_MOSI_PIN NRF_GPIO_PIN_MAP(1,9) //29
#define SPI_1_MISO_PIN NRF_GPIO_PIN_MAP(1,8) //30
#define SPI_1_CS_PIN 11 //NRF_DRV_SPI_PIN_NOT_USED
#define SPI_1_FREQUENCY NRF_DRV_SPI_FREQ_125K
#define SPI_1_MODE NRF_DRV_SPI_MODE_0
#define SPI_1_BIT_ORDER NRF_DRV_SPI_BIT_ORDER_MSB_FIRST
#define SPI_1_IRQ_PRIORITY NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY
o
And make it look something like this:
#define SPI_2_CLK_PIN <your clock pin>
#define SPI_2_MOSI_PIN <your MOSI pin>
#define SPI_2_MISO_PIN <your MISO pin>
#define SPI_2_CS_PIN <your CS pin>
#define SPI_2_FREQUENCY <your selection of standard NRF SPI frequencies>
#define SPI_2_MODE <your SPI mode>
#define SPI_2_BIT_ORDER <your devices bit order> Note: MSB first is by far the most common for SPI
#define SPI_2_IRQ_PRIORITY <your desired IRQ priority> Note: For most cases, the “default” is most appropriate,
as above.
o
Create the following struct in your new HAL source file:
static nrf_drv_spi_config_t m_spi2Config =
{
.sck_pin = SPI_2_CLK_PIN,
.mosi_pin = SPI_2_MOSI_PIN,
.miso_pin = SPI_2_MISO_PIN,
.ss_pin = SPI_2_CS_PIN,
.irq_priority = SPI_2_IRQ_PRIORITY,
.orc = 0xFF,
.frequency = SPI_2_FREQUENCY,
.mode = SPI_2_MODE,
.bit_order = SPI_2_BIT_ORDER
};
o
Modify the remaining functions in the HAL to point to your new instance of SPI Master port.
Adding a SPI Slave port:
The Nordic nRF52840 can support one SPI slave port. Configuring such a port allows a host processor that may be on your
carrier board to send instructions to the Nordic on the ST150M board as a master.
o
You will need to remove the 4 pins you wish to use for the SPI Slave port from the GPIO list as in the sections
above.
o
You will need to write a custom HAL for the SPI Slave device.
o
The HAL for the SPI Master device in the Globalstar ST150M SDK should be useful as a template for this
HAL. However, you will need to consult the Nordic SDK documentation as a reference how to link your new HAL into
the SPI Slave control functions.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Globalstar ST150 and is the answer not in the manual?

Globalstar ST150 Specifications

General IconGeneral
BrandGlobalstar
ModelST150
CategoryControl Unit
LanguageEnglish

Related product manuals