Globalstar ST150M User Manual page 24

Hide thumbs Also See for ST150M:
Table of Contents

Advertisement

9150-0125-01 R-1
Advanced users can tweak the settings, or assign other module GPIO pins (after removing those pins from the GPIO list) by
calling the function above with a pointer to a structure like the following (default values shown):
static i2c_config_t m_i2c_hal_default_config =
{
.u32_scl_pin
.u32_sda_pin
.frequency
.u8_interrupt_priority
};
Assigning pins for peripheral interface.
To assign pins for use by peripheral devices (SPI ports, I2C ports, UARTS, etc), they should first be removed from the GPIO list in
the file: UAPI_GPIO_list.c
Then, the pins you intend to assign should be reserved in the GPIO library with a call to the function: int32_t g_library_set_pin_
pinmap_by_pin_number(uint32_t u32_pin_no);
This function takes the Nordic pin number as an argument and will return an error code if the pin is already reserved. The function
is found in GSTAR_Library_gpio.c and its definition can be included in your source file by including GSTAR_Library_gpio.h
To check if a pin is already reserved, use:
int32_t g_library_get_pin_pinmap_by_pin_number(uint32_t u32_pin_no);
Example of re-assigning an I2C peripheral:
Remove the pins you intend to use for the I2C peripheral from the GPIO list in UAPI_GPIO_list.c (as described in the previous section).
You could, optionally, add GPIO definitions to the "default" I2C pins that you are re-assigning. o I2C_CLK = 43 (1.11) o
I2C_SDA = 45 (1.13)
Use the function "int32_t g_library_set_pin_pinmap_by_pin_number(uint32_t u32_pin_no);" to reserve the pins you intend to
move the I2C peripheral to.
Create a structure as shown below, with the pin assignments you intend to use.
Then call: o bool ret_val = i2c_initialize_hal(&m_i2c_hal_my_config)
i2c_config_t m_i2c_hal_my_config =
{
.u32_scl_pin
.u32_sda_pin
.frequency
.u8_interrupt_priority
};
Setting up a SPI master peripheral:
The Nordic nRF52840 can support up to 4 SPI master interfaces. At the Nordic SDK level, the SPI Master interfaces are identified
via "instances" 1 – 4. The ST150M uses instance 1 to communicate with its on board GPS receiver. External devices cannot be
added to this SPI port since its signals are dedicated to the GPS and are not brought out to external pins. This leaves instances 2 –
4 available for other uses via custom code.
The basic steps in setting up an additional SPI instance is as follows:
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.
ST150M User Manual
= I2C_1_SCL_PIN,
= I2C_1_SDA_PIN,
= I2C_1_FREQUENCY,
= APP_IRQ_PRIORITY_LOW,
= I2C_1_SCL_PIN,
= I2C_1_SDA_PIN,
= I2C_1_FREQUENCY,
= APP_IRQ_PRIORITY_LOW,
Confidential & Proprietary Information
16

Advertisement

Table of Contents
loading

Table of Contents