Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
ctboard:peripherals:gpio [2016/02/25 10:54] – [Programming Example] feurctboard:peripherals:gpio [2017/08/29 09:19] (current) – [GPIO] ruan
Line 1: Line 1:
 ====== GPIO ====== ====== GPIO ======
  
-The CT Board offers on the 4 general purpouse ports the following functions: +The CT Board offers on the 4 general purpose ports the following functions: 
-  * 4 general purpouse I/O ports+  * 4 general purpose I/O ports
     * 32 memory mapped output pins     * 32 memory mapped output pins
     * 32 memory mapped input pins     * 32 memory mapped input pins
-  * 2 general purpouse I/O ports, directly connected to MCUs [[stm32:peripherals:gpio|Port A and B]]+  * 2 general purpose I/O ports, directly connected to MCUs [[stm32:peripherals:gpio|Port A and B]]
   * External interface to [[memory_bus|SRAM bus]].   * External interface to [[memory_bus|SRAM bus]].
 \\ \\
  
-===== GPIO over CPLD =====+===== Functions =====
  
-Each of the 4 GPIO ports contains 8 ouput and 8 input pins. The ports are not as fast as the integrated [[stm32:peripherals:gpio|GPIO ports]] of the microcontroller. \\ \\+These modes are available:
  
-> {{ctboard:ctboard_mode_1.svg?48px }} Please make sure the CT Board is in the correct mode. +  * [[gpio_cpld|GPIO over CPLD]] for input output on ports P1..4. 
-> Supported [[ctboard:mode_switch|mode]]: **1** +  * [[gpio_mcu|GPIO over MCU]] for input / output on ports P5 / P6.
-\\ +
- +
-==== Programming Example ==== +
- +
-The code snippet bellow shows how to use the GPIO. +
- +
-<code c> +
-#include "reg_ctboard.h" +
- +
-uint8_t data_byte = CT_GPIO->IN.BYTE.P1;              /* Read byte from P1. */ +
-uint16_t data_hword = CT_GPIO->IN.HWORD.P2_1;         /* Read half word from P1 and P2. */ +
-uint32_t data_word = CT_GPIO->IN.WORD;                /* Read word from all ports (P1..4)*/ +
- +
-CT_GPIO->OUT.BYTE.P3 = (uint8_t) data_byte;           /Write byte of data to P3. */ +
-CT_GPIO->OUT.HWORD.P4_3 = (uint16_t) data_halfword;   /* Write halfword of data to P3..4 */ +
-CT_GPIO->OUT.WORD = (uint32_t) data_word;             /* Write data to all ports (P1..4). */ +
-</code> +
-\\ +
- +
-==== Registers ==== +
- +
-=== Input === +
- +
-\\ {{ ctboard_gpio_pinout.svg?300em}}  +
-   {{ctboard_gpio_input_reg.svg}} \\ \\ +
- +
-=== Output === +
- +
-The Registers are read / write. +
- +
-\\ {{ctboard_gpio_output_reg.svg}} \\ \\ +
- +
-==== Diagram ==== +
- +
-\\ {{ctboard_gpio_cpld.svg}} \\ \\ +
- +
-===== GPIO over MCU ===== +
- +
-These two ports are directly connected to the [[stm32:peripherals:gpio|GPIO ports A and B]] on the microcontroller. \\ +
-All [[stm32:peripherals:gpio#alternate_functions|functions]] of theese GPIO ports are available. \\ \\ +
- +
-> {{ctboard:ctboard_mode_no.svg?48px }} This functionality is independent of the CT Board mode. +
-> Supported modes: Available in all [[ctboard:mode_switch|modes]].  +
-\\ +
- +
-==== Programming Example ==== +
- +
-To configure and use these Ports, setup [[stm32:peripherals:gpio|GPIO port A/B]] on the microcontroller. \\ \\ +
- +
-==== Diagram ==== +
- +
-> Only pins 0..11 are connected to P5 / P6! The other 4 pins are used for 5V, 3.3V and GND. +
- +
-\\ {{ctboard_gpio_stm32.svg}} \\ \\+
  
  
  
  • ctboard/peripherals/gpio.1456397699.txt.gz
  • Last modified: 2016/02/25 10:54
  • by feur