Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

AT32UC3C FLASHC Problem

Status
Not open for further replies.

Pheetuz

Full Member level 3
Joined
Feb 12, 2010
Messages
162
Helped
21
Reputation
42
Reaction score
19
Trophy points
1,298
Location
Brighton
Activity points
2,835
Hi Folks,
I am trying to use the Flash Controller in the AT32 series of devices but not having a lot of luck - I have tried using the demo project but that only works intermittently (like very intermittently) occasionally setting the correct memory locations but most of the time doing nothing unless I am writing into the user page where it works consistently.

I decided to move away from using the demo application and do something a little more bare bones and have come up with this:

Code:
int main(void)
{
	/* Points to FLASH */
	uint32_t *mem = (uint32_t*)0x8007F000;
	uint16_t pageNumber = 0;
	avr32_flashc_t * temp = &AVR32_FLASHC;
	
	// Switch main clock to external oscillator 0 (crystal).
	pcl_switch_to_osc(PCL_OSC0, FOSC0, OSC0_STARTUP);
	
	/* Clear the page buffer. */
	AVR32_FLASHC.FCMD.cmd = 3;
	AVR32_FLASHC.FCMD.key = 0xA5;
	
	/* Read with a single wait state. */	
	AVR32_FLASHC.FCR.fws = 1;
	pageNumber = AVR32_FLASHC.FCMD.pagen;
	*mem = 4;
	pageNumber = AVR32_FLASHC.FCMD.pagen;
	/* Write page. */
	AVR32_FLASHC.FCMD.cmd = 1;
	
	AVR32_FLASHC.FCMD.key = 0xA5;
}

Which I have seen once set the value at the desired memory location to the value 4! Exciting! It seems that this basic code is suffering the same problem as the demo code provided by Atmel - does anyone have any idea why this would not be working as expected?

I am using the AT32UC3C-EK development board so doubtful that it is a hardware cause!

Thanks,
Pete
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top