Code to load a LPC1114 over tx/rx. I have only tested with a 1114 chip but it should work with other LPC uControllers
Dependencies: DirectoryList MODSERIAL mbed
Fork of ika_shouyu_poppoyaki by
target_handling.cpp
- Committer:
- okano
- Date:
- 2013-09-25
- Revision:
- 33:ce9fff4cbf09
- Parent:
- 28:689c3880e0e4
- Child:
- 35:0b434ef4af49
File content as of revision 33:ce9fff4cbf09:
#include "mbed.h" #include "target_handling.h" #include "target_table.h" #include "command_interface.h" #include "serial_utilities.h" DigitalOut reset_pin( p26 ); DigitalOut isp_pin( p25 ); target_param *open_target( int baud_date ) { target_param *tpp; char str_buf0[ STR_BUFF_SIZE ]; char str_buf1[ STR_BUFF_SIZE ]; int retry_count = 3; set_target_baud_rate( baud_date ); while ( retry_count-- ) { reset_target( ENTER_TO_ISP_MODE ); if ( !try_and_check( "?", "Synchronized", 0 ) ) break; } if ( !retry_count ) return ( NULL ); try_and_check2( "Synchronized\r\n", "OK", 0 ); try_and_check2( "12000\r\n", "OK", 0 ); try_and_check2( "U 23130\r\n", "0", 0 ); try_and_check2( "A 0\r\n", "0", 0 ); try_and_check( "K\r\n", "0", 0 ); get_string( str_buf0 ); get_string( str_buf1 ); printf( " result of \"K\" = %s %s\r\n", str_buf0, str_buf1 ); try_and_check( "J\r\n", "0", 0 ); get_string( str_buf0 ); printf( " result of \"J\" = %s\r\n", str_buf0 ); tpp = find_target_param( str_buf0 ); return ( tpp ); } void reset_target( int isp_pin_state ) { reset_pin = 1; isp_pin = isp_pin_state; wait_ms( 100 ); reset_pin = 0; wait_ms( 100 ); reset_pin = 1; wait_ms( 100 ); }