Build Error when I changed the project of xmega128a1u to xmega128a1

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use a project building by setting of xmega128A1U.

 

But I use xmega128A1.

 

It was different and experienced troublesome repair work by the BOD level setting of the fuse bit of the BOD before.

 

Therefore I would like to to change the setting of the project to xmega128A1.

 

However, there is the following build error.

 

 

Error    319    'PORT_SPI_bm' undeclared (first use in this function)    C:\mywork\source\myproject\branches\CarWatch_20150722\MainUnit\port.c    32    18    MainUnit
Error    318    'PORT_t' has no member named 'REMAP'    C:\mywork\source\myproject\branches\CarWatch_20150722\MainUnit\port.c    32    7    MainUnit

 

 

 

 

This part of the next cord  is an error.

PORTE.REMAP  |= PORT_SPI_bm;

 

 

 


void port_init_direction(void)
{
	/*in-out setup */
	PORTA.DIR = 0x5f;
	PORTB.DIR = 0x60;
	PORTC.DIR = PIN3_bm;
	PORTD.DIR = PIN4_bm | PIN5_bm | PIN1_bm;
	PORTE.DIR = PIN2_bm | PIN4_bm | PIN5_bm | PIN7_bm;
	PORTF.DIR = PIN1_bm | PIN5_bm;
	PORTH.DIR = 0xff;
	PORTJ.DIR = 0xff;
	PORTK.DIR = 0xff;
	
	PORTE.PIN2CTRL = 0x18; // pullup , both edge
	PORTE.REMAP  |= PORT_SPI_bm;


	
}

 

 

I connect a wireless device called cc1101 to SPI port of PORTE.

 

 

Please tell me about a solution.

 

Thanks.

 

 

 

 

This topic has a solution.

kenji maehara

Last Edited: Fri. Sep 16, 2016 - 01:50 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use a project building by setting of xmega128A1U.

 

But I use xmega128A1.

Which controller did you select while creating project?

 

If you are using XMEGA128A1 then you have to select the same while creating project.

 

The reason you got ERROR 319 is, there is no PORT_SPI_bm in XMEGA128A1 but it is in XMEGA128A1U.

 

Look in device specific headers iox128a1.h and iox128a1u.h respectively.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to note that it is very unwise to use a 128A1 because it is full of bugs. The whole reason Atmel stopped production and phased them out with the 128A1U replacement was to fix all the problems the chip had.

 

As to the original question:

 

/usr/lib/avr/include/avr$ grep PORT_SPI_bm iox128*.h
/usr/lib/avr/include/avr$ ls iox128*.h
iox128a1.h  iox128a1u.h  iox128a3.h  iox128d3.h

On my machine (gcc 4.5.3) that shows that neither 128a1 nor 128a1u has a symbol called PORT_SPI_bm. Is it a local definition in your project?

 

EDIT: just checked a copy of avr-gcc 4.8.1...

~/windows/avr8-gnu-toolchain-linux_x86_64/avr/include/avr$ grep PORT_SPI_bm iox128*.h
iox128a1u.h:#define PORT_SPI_bm  0x20  /* SPI bit mask. */
iox128a3u.h:#define PORT_SPI_bm  0x20  /* SPI bit mask. */
iox128a4u.h:#define PORT_SPI_bm  0x20  /* SPI bit mask. */
iox128b1.h:#define PORT_SPI_bm  0x20  /* SPI bit mask. */
iox128b3.h:#define PORT_SPI_bm  0x20  /* SPI bit mask. */
iox128c3.h:#define PORT_SPI_bm  0x20  /* SPI bit mask. */
iox128d4.h:#define PORT_SPI_bm  0x20  /* SPI bit mask. */
~/windows/avr8-gnu-toolchain-linux_x86_64/avr/include/avr$ ls iox128*.h
iox128a1.h  iox128a1u.h  iox128a3.h  iox128a3u.h  iox128a4u.h  iox128b1.h  iox128b3.h  iox128c3.h  iox128d3.h  iox128d4.h

So it seems that between 4.5.3 and 4.8.1 the symbol was added to iox128a1u.h

 

As your iox128a1.h does not have it then I suggest you just lift this from the header file of the newer chip and put that #define in your own code as:

#ifndef PORT_SPI_bm
#define PORT_SPI_bm 0x20
#endif

Do the same for the PORT_t typedef.

Last Edited: Wed. Jul 29, 2015 - 09:44 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,Mandar Joshi 

Thank you for your reply.An answer becomes slow and is sorry.

 

kenji maehara

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,clawson

Thank you for your reply.An answer becomes slow and is sorry.

kenji maehara