This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to use GPIO interface IPs of ARM Cortex M0+

Hello,

We bought ARM CM0+ deliverables from ARM. I want to design an SoC which has to get data from an another system .The aim of the SoC is to process an array of 4096 samples received from the external world.For the data interfacing, we are using GPIO interface IPs provided by ARM as part of deliverables.

Can anyone explain how the GPIO works in CM0+ and how to program in C?

Thanks,

Sabarish

Parents
  • The register map and behaviour of any component provided by ARM will be in the documentation accompanying the component, or can be obtained via support.

    As general guidance, all peripherals in Cortex-M will be memory mapped and as such you just need to create and interact with volatile pointers in C to configure / access them, e.g.:

    #include <stdint.h>
    
    // Volatile pointer to some register at 0xABCD1234
    volatile uint32_t *const PERIPH_REG = (uint32_t*) 0xABCD1234;
    
    uint32_t func(uint32_t value_to_write)
    {
      uint32_t value_read;
      value_read = *PERIPH_REG;     // Perform a read
      *PERIPH_REG = value_to_write; // Perform a write
      *PERIPH_REG = value_to_write; // Perform another (identical) write
      return value_read;
    }
    

     

    Will perform 32-bit reads and writes to 0xABCD1234.

    Best regards,

    Simon.

Reply
  • The register map and behaviour of any component provided by ARM will be in the documentation accompanying the component, or can be obtained via support.

    As general guidance, all peripherals in Cortex-M will be memory mapped and as such you just need to create and interact with volatile pointers in C to configure / access them, e.g.:

    #include <stdint.h>
    
    // Volatile pointer to some register at 0xABCD1234
    volatile uint32_t *const PERIPH_REG = (uint32_t*) 0xABCD1234;
    
    uint32_t func(uint32_t value_to_write)
    {
      uint32_t value_read;
      value_read = *PERIPH_REG;     // Perform a read
      *PERIPH_REG = value_to_write; // Perform a write
      *PERIPH_REG = value_to_write; // Perform another (identical) write
      return value_read;
    }
    

     

    Will perform 32-bit reads and writes to 0xABCD1234.

    Best regards,

    Simon.

Children