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: | ||
| ====== Programmable Peripheral Interconnect ====== | ====== Programmable Peripheral Interconnect ====== | ||
| - | PPI is used | + | Programmable Peripheral Interconnect (PPI) is the matrix that creates programmable connections between the internal peripherals |
| - | The second part of the laboratory shows how to use the PPI to send the activation information | + | |
| - | 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: | + | |
| - | CONFIG_NRFX_GPIOTE=y | + | ===== Using PPI with GPIO ===== |
| - | There is a need to disable the general | + | |
| + | 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_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 part of the laboratory take the following steps: | + | </code> |
| - | Modify the prj.conf file. | + | |
| - | Replace main.c with the code included below. | + | |
| - | Modify the code to turn the LED on with one button, and off with another button. | + | |
| - | 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 | + | |
| - | 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. There is no need to configure SET or CLEAR tasks, but there is a need to create separate PPI channels, one for setting LED with one button, and another for clearing it with a second button. | + | |
| - | While creating channels you can use the functions for resolving the TASKs handlers addresses: | + | |
| + | ===== Tasks to be done during the laboratory ===== | ||
| + | |||
| + | To do this part of the laboratory take the following steps: | ||
| + | - Modify the prj.conf file. | ||
| + | - Replace main.c with the code included below. | ||
| + | - Modify the code to turn the LED on with one button, and off with another button. | ||
| + | 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 | ||
| + | * CLEAR - to write the low state | ||
| + | * OUT - to specify behaviour in the configuration (set, clear or toggle). | ||
| + | The example provided uses the OUT task only with toggle configuration. In the exercise, while replacing the OUT task with SET and CLEAR there is no need to configure such tasks, but there is a need to create separate PPI channels, one for setting LED with one button, and another for clearing it with a second button. | ||
| + | While creating channels you can use the functions for resolving the TASK's handlers addresses: | ||
| + | < | ||
| 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.1700679701.txt.gz · Last modified: by ktokarz
