No ACL setup yet! Denying access to everyone.
en:edu:zmitac:s2:aih:lab:nrf52gpiote
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:edu:zmitac:s2:aih:lab:nrf52gpiote [2023/11/22 20:01] – ktokarz | en:edu:zmitac:s2:aih:lab:nrf52gpiote [2023/12/01 13:51] (current) – ktokarz | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Peripheral Interconnect ====== | + | ====== |
| + | Programmable Peripheral Interconnect (PPI) is the matrix that creates programmable connections between the internal peripherals of the microcontroller. It is possible to connect output signals from peripherals known as EVENTS with inputs of other peripherals known as TASKS. It is possible to connect the input and output of the same peripheral creating so-called SHORTCUT. PPI is used to create direct connections that transmit control signals without the need for program execution. | ||
| - | The second part of the laboratory shows how to use the PPI to send the activation information from the button (sw0) directly to the LED (led0). It is possible to set up the hardware connection between the button EVENT signal and the TASK signal for LED. While the output is controlled by the GPIOTE mechanism the normal | + | ===== Using PPI with GPIO ===== |
| - | The example provided uses the GPIOTE (GPIO Tasks and Events) to handle signalling. To make it work properly the config file must be changed, enabling the NRFX driver: | + | |
| + | This part of the laboratory shows how to use the PPI to send the activation information from the button (sw0) directly to the LED (led0). It is possible to set up the hardware connection between the button EVENT signal and the TASK signal for LED. While the output is controlled by the GPIOTE (GPIO Tasks and Events) mechanism the normal GPIO writes have no effect. The GPIOTE mechanism is not supported in Zephyr OS, but the driver (NRFX) which is provided directly by Nordic Semiconductor can be used in Zephyr-compatible software. Every connection between EVENT and TASK is done by defining the channel. The number of available channels is limited to 8. | ||
| + | The example provided uses the GPIOTE to handle signalling. To make it work properly the config file must be changed, enabling the NRFX driver, and disabling the general GPIO driver: | ||
| + | < | ||
| CONFIG_NRFX_GPIOTE=y | CONFIG_NRFX_GPIOTE=y | ||
| - | There is a need to disable the general GPIO driver: | ||
| - | |||
| CONFIG_GPIO=n | CONFIG_GPIO=n | ||
| + | </ | ||
| Additionally, | Additionally, | ||
| + | < | ||
| CONFIG_LOG=y | CONFIG_LOG=y | ||
| + | </ | ||
| The resulting config file prj.conf looks like this: | The resulting config file prj.conf looks like this: | ||
| + | < | ||
| CONFIG_GPIO=n | CONFIG_GPIO=n | ||
| CONFIG_SERIAL=y | CONFIG_SERIAL=y | ||
| CONFIG_NRFX_GPIOTE=y | CONFIG_NRFX_GPIOTE=y | ||
| CONFIG_LOG=y | CONFIG_LOG=y | ||
| - | To do the second | + | </ |
| - | Modify the prj.conf file. | + | |
| - | Replace main.c with the code included below. | + | ===== Tasks to be done during the laboratory ===== |
| - | Modify the code to turn the LED on with one button, and off with another button. | + | |
| + | To do this part of the laboratory take the following steps: | ||
| + | | ||
| + | | ||
| + | | ||
| To make point 3 of the exercise it is essential to know that one GPIO can have three TASK signals: | To make point 3 of the exercise it is essential to know that one GPIO can have three TASK signals: | ||
| - | SET - to write the high state | + | * SET - to write the high state |
| - | CLEAR - to write the low state | + | |
| - | OUT - to specify behaviour in the configuration (set, clear or toggle). | + | |
| - | The example provided uses the OUT TASK with toggle configuration. | + | The example provided uses the OUT task only with toggle configuration. |
| - | While creating channels you can use the functions for resolving the TASKs handlers addresses: | + | While creating channels you can use the functions for resolving the TASK' |
| + | < | ||
| nrfx_gpiote_set_task_addr_get(); | nrfx_gpiote_set_task_addr_get(); | ||
| nrfx_gpiote_clr_task_addr_get(); | nrfx_gpiote_clr_task_addr_get(); | ||
| + | </ | ||
| The initial, unmodified code of the main.c file looks like this: | The initial, unmodified code of the main.c file looks like this: | ||
| + | < | ||
| /* | /* | ||
| * Copyright (c) 2019 Nordic Semiconductor ASA | * Copyright (c) 2019 Nordic Semiconductor ASA | ||
| Line 178: | Line 188: | ||
| LOG_INF(" | LOG_INF(" | ||
| } | } | ||
| + | </ | ||
en/edu/zmitac/s2/aih/lab/nrf52gpiote.1700679666.txt.gz · Last modified: by ktokarz
