TWR-K60N512-KEIL Freescale Semiconductor, TWR-K60N512-KEIL Datasheet - Page 90

no-image

TWR-K60N512-KEIL

Manufacturer Part Number
TWR-K60N512-KEIL
Description
K60N512 Keil Tower Kit
Manufacturer
Freescale Semiconductor
Series
Kinetisr
Type
MCUr

Specifications of TWR-K60N512-KEIL

Rohs Compliant
YES
Contents
4 Boards, Documentation, DVD
Peak Reflow Compatible (260 C)
Yes
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
For Use With/related Products
Freescale Tower System, K60N512
Using the EzPort module
9.1.2.2 Write enable and disable
Before issuing a write command (SP, SE, BE, WRFCCOB, or WRFLEXRAM) in the
Ezport module, first enable the WEN bit in the status register with the WREN command.
After those commands are completed, the WEN bit will automatically clear so next time
you issue another write command, the WREN command should be issued again.
Example code:
//ezp_wren_cmd
ezp_write_byte(EZPORT_WREN);
while (!(MCF5282_QSPI_QIR & MCF5282_QSPI_QIR_SPIF));
//ezp_wrdi_cmd
ezp_write_byte(EZPORT_WRDI);
while (!(MCF5282_QSPI_QIR & MCF5282_QSPI_QIR_SPIF));
9.1.2.3 Sector erase and program
The SP command programs up to one section of flash memory that has previously been
erased by an SE command. The starting address of both commands should be 64-bit
aligned (three LSBs being zero). The Ezport module buffer will receive program data in
FlexRAM/programming acceleration RAM before executing the SP command, so the
number of bytes to be programmed should be a multiple of eight and up to one section
size at a time.
Example code:
set_to_ezp_mode();
ezp_spi_init(0,6,0,0);
// 1. Boot-up from reset with EZPORT enabled.
ezp_wren_cmd();
// 2. Verify WEN flag is set.
sr = ezp_rdsr_cmd();
{
error_count++;
}
//3. Sector erase
ezp_se_cmd(sector_addr);
// Poll SR
90
//Loop till command has completed
while ((sr & EP_SR_WIP) == EP_SR_WIP)
if (sr != EP_SR_WEN)
sr = EP_SR_WIP;
printf("Failure in SR value: WEN not set\n");
until WIP goes low
The code above assumes lower level byte sending with QSPI
has been implemented with ezp_write_byte. You could easily
implement this and port it to other SPI modules like DSPI.
Kinetis Quick Reference User Guide, Rev. 0, 11/2010
/* max permitted clock speed for read */
NOTE
Freescale Semiconductor

Related parts for TWR-K60N512-KEIL