/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / MAPR2 Register?

Username:     
Password:     
             

Forum

# 1   2011-07-24 04:24:58 MAPR2 Register?

dohzer
New member
From: Melbourne
Registered: 2009-12-08
Posts: 4

MAPR2 Register?

A compilation issue popped up when I included the V3.4.0 $1 file in my project and started accessing Timer 2 using the TIM library.
It looks like there is a problem with the library AFIO_TypeDef structure not including MAPR2 register, but still trying to access it. Has anyone else had the same problem? Is there an easy solution?

From the V3.4.0 $1 file:

Code:

void GPIO_PinRemapConfig(uint32_t GPIO_Remap, FunctionalState NewState)
{
  uint32_t tmp = 0x00, tmp1 = 0x00, tmpreg = 0x00, tmpmask = 0x00;

  /* Check the parameters */
  assert_param(IS_GPIO_REMAP(GPIO_Remap));
  assert_param(IS_FUNCTIONAL_STATE(NewState));  
  
  if((GPIO_Remap & 0x80000000) == 0x80000000)
  {
    tmpreg = AFIO->MAPR2;
  }
  else
  {
    tmpreg = AFIO->MAPR;
  }

  tmpmask = (GPIO_Remap & DBGAFR_POSITION_MASK) >> 0x10;
  tmp = GPIO_Remap & LSB_MASK;

  if ((GPIO_Remap & (DBGAFR_LOCATION_MASK | DBGAFR_NUMBITS_MASK)) == (DBGAFR_LOCATION_MASK | DBGAFR_NUMBITS_MASK))
  {
    tmpreg &= DBGAFR_SWJCFG_MASK;
    AFIO->MAPR &= DBGAFR_SWJCFG_MASK;
  }
  else if ((GPIO_Remap & DBGAFR_NUMBITS_MASK) == DBGAFR_NUMBITS_MASK)
  {
    tmp1 = ((uint32_t)0x03) << tmpmask;
    tmpreg &= ~tmp1;
    tmpreg |= ~DBGAFR_SWJCFG_MASK;
  }
  else
  {
    tmpreg &= ~(tmp << ((GPIO_Remap >> 0x15)*0x10));
    tmpreg |= ~DBGAFR_SWJCFG_MASK;
  }

  if (NewState != DISABLE)
  {
    tmpreg |= (tmp << ((GPIO_Remap >> 0x15)*0x10));
  }

  if((GPIO_Remap & 0x80000000) == 0x80000000)
  {
    AFIO->MAPR2 = tmpreg;
  }
  else
  {
    AFIO->MAPR = tmpreg;
  }  
}

There are two lines in the above code the same as this:

Code:

AFIO->MAPR2 = tmpreg;

Looking at the AFIO definition in V3.4.0 $1:

Code:

    typedef struct
    {
        __IO uint32_t EVCR;
        __IO uint32_t MAPR;
        __IO uint32_t EXTICR[4];
    } AFIO_TypeDef;

...there is no MAPR2 register, only MAPR. Is this an error or have I done something wrong? Is there a different file I should be using? If it matters, I'm writing code for the STM32 Primer2.

Also, is there a file I can download which contains all the latest library files? I feel like I'm always unsure about which version is the newest.

Offline

 

# 2   2011-07-24 10:07:50 MAPR2 Register?

dohzer
New member
From: Melbourne
Registered: 2009-12-08
Posts: 4

Re: MAPR2 Register?

I don't think it matters too much, but the errors I am getting is:

Code:

<project_directory>stm32f10x_gpio.c:556:18: error: 'AFIO_TypeDef' has no member named 'MAPR2'  
<project_directory>stm32f10x_gpio.c:590:9: error: 'AFIO_TypeDef' has no member named 'MAPR2'

Offline

 

# 3   2011-07-24 12:07:20 MAPR2 Register?

dohzer
New member
From: Melbourne
Registered: 2009-12-08
Posts: 4

Re: MAPR2 Register?

Sorry, solved the problem. For some silly reason the $1 and $1 were version 3.1.0. I swear I checked, but must have missed it.
My bad!

Offline

 

# 4   2011-09-20 06:45:33 MAPR2 Register?

jonymac001
New member
Registered: 2011-09-20
Posts: 5

Re: MAPR2 Register?

Hello Everybody!

New to the fourms. Thought I'd post a note on what I'm doing.

I've been designing embedded micro-controller boards for ages. I've mostly been using Motorola 68xx, 68xxx, and Rabbit processors. Just recently a friend turned me on to Arduinos. I have two Uno's, a Mega, a Pro, and a Sanguino. About two weeks ago I designed my first Atmel based board using a '644 like on the Sanguino. (Incorporating an automotive LIN bus driver. Hacking newsoftserial to handle 10400 baud along the way)

Offline

 

Board footer