Ika Shouyu Poppoyaki - LPC82x supported

Dependencies:   MODSERIAL mbed

Fork of ika_shouyu_poppoyaki by Tedd OKANO

Committer:
okano
Date:
Fri Sep 20 02:21:58 2013 +0000
Revision:
30:e0d7524661ca
Parent:
29:96e28bc1bd99
Child:
31:1a4d59d7bd72
** version 0.95. redundant code and files are removed

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okano 11:8dfc3217d1ca 1 /**
okano 11:8dfc3217d1ca 2 * Sample of ISP operation for NXP MCUs
okano 11:8dfc3217d1ca 3 *
okano 14:a7b9f74fb856 4 * @author Tedd OKANO
okano 30:e0d7524661ca 5 * @version 0.95
okano 18:b401da200216 6 * @date Sep-2013
okano 26:a63e73885b21 7 *
okano 26:a63e73885b21 8 * This program programs MCU flash memory through UART. It uses
okano 14:a7b9f74fb856 9 * "In-System Programming (ISP)" interface in target MCU (NXP LPC micro-
okano 14:a7b9f74fb856 10 * controllers).
okano 26:a63e73885b21 11 *
okano 26:a63e73885b21 12 * The ISP is done by PC and serial cable normally. The ISP protocol is
okano 14:a7b9f74fb856 13 * executed software on a PC. The software reads a data file and transfers
okano 26:a63e73885b21 14 * the data with the ISP protocol.
okano 26:a63e73885b21 15 * This program does same process of that. The mbed perform the function like
okano 14:a7b9f74fb856 16 * "FlashMagic" and "lpc21isp".
okano 26:a63e73885b21 17 * (This program not just copies the binary but also insert 4 byte checksum at
okano 14:a7b9f74fb856 18 * address 0x1C.)
okano 26:a63e73885b21 19 *
okano 26:a63e73885b21 20 * This program currently supports LPC1114(LPC1114FN28/102 - DIP28-ARM) and
okano 14:a7b9f74fb856 21 * LPC810(LPC810M021FN8 - DIP8-ARM).
okano 11:8dfc3217d1ca 22 */
okano 11:8dfc3217d1ca 23
okano 5:ff30f5b58617 24 #include "mbed.h"
okano 30:e0d7524661ca 25 #include "isp.h"
okano 22:bd98a782fba6 26 #include "serial_utilities.h"
okano 25:33cb5ad8ae24 27 #include "_user_settings.h"
okano 21:e149d0bdbf4a 28
okano 30:e0d7524661ca 29
okano 2:8d75eb0ecd20 30 LocalFileSystem local( "local" );
okano 7:815366f003ee 31
okano 19:7a7381e78025 32
okano 7:815366f003ee 33 int main()
okano 7:815366f003ee 34 {
okano 28:689c3880e0e4 35 int err;
okano 30:e0d7524661ca 36
okano 30:e0d7524661ca 37 printf( "\r\n\r\n\r\nmbed ISP program : programming LPC device from mbed (v0.95)\r\n" );
okano 30:e0d7524661ca 38
okano 28:689c3880e0e4 39 err = isp_flash_write( SOURCE_FILE );
okano 30:e0d7524661ca 40
okano 8:b220fadbb3d8 41 printf( "\r\n %s\r\n\r\n",
okano 28:689c3880e0e4 42 err ?
okano 8:b220fadbb3d8 43 "** The data could not be written :(" :
okano 8:b220fadbb3d8 44 "** The data has been written successflly :)"
okano 8:b220fadbb3d8 45 );
okano 26:a63e73885b21 46
okano 28:689c3880e0e4 47 if ( err )
okano 19:7a7381e78025 48 error( " ** ISP failed\r\n" );
okano 26:a63e73885b21 49
okano 14:a7b9f74fb856 50 #ifdef AUTO_PROGRAM_START
okano 30:e0d7524661ca 51 //set_target_baud_rate( TARGET_OPERATION_BAUD_RATE );
okano 30:e0d7524661ca 52 //reset_target( NO_ISP_MODE );
okano 30:e0d7524661ca 53
okano 30:e0d7524661ca 54 start_target_in_normal_mode( TARGET_OPERATION_BAUD_RATE );
okano 16:cac2348cfcfb 55
okano 16:cac2348cfcfb 56 printf( " ** The program in flash has been started!!\r\n" );
okano 14:a7b9f74fb856 57 #endif
okano 14:a7b9f74fb856 58
okano 16:cac2348cfcfb 59 printf( " (now the mbed is working in \"serial through mode\")\r\n\r\n" );
okano 16:cac2348cfcfb 60
okano 30:e0d7524661ca 61 // success.attach( &success_indicator, 0.1 );
okano 30:e0d7524661ca 62 start_success_indicator();
okano 16:cac2348cfcfb 63
okano 21:e149d0bdbf4a 64 usb_serial_bridge_operation(); // doesn't return. infinite loop in this function
okano 20:98d7b5878e3e 65 }
okano 16:cac2348cfcfb 66
okano 20:98d7b5878e3e 67