From 917aa733ff6c707ba8a91c203c78b57981e35ee7 Mon Sep 17 00:00:00 2001 From: yul Date: Sun, 29 May 2022 00:05:04 +0200 Subject: [PATCH] the ok not working. for the moment work around with bla --- bootloader.c | 8 ++++---- uart_commands.c | 17 +++++++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/bootloader.c b/bootloader.c index 2a63285..ba7ec17 100644 --- a/bootloader.c +++ b/bootloader.c @@ -116,11 +116,12 @@ void manage_bootloader(){ error_code is_error = uart_commands_check(crc_prog, crc_data); if(is_error == ok){ uart_send_ok(); - break; + uart_send("bla\r\n", 5);//putting bla here so OK will show up + //removing bla for the moment will make ok not show up + launch_program(); }else{ uart_send_err(); } - } } } @@ -130,7 +131,7 @@ int main(void) { //checksum is correct ( //bootloader_init(); uart_init(115200); - LPC_GPIO0->FIODIR &=~(1<<19); + LPC_GPIO0->FIODIR &=~(1<<19); //do I really need this line? if(is_b_pressed() == 0){ if(is_code_valid()){ launch_program(); @@ -140,7 +141,6 @@ int main(void) { }else{ manage_bootloader(); } - launch_program(); while(1); return 0 ; } diff --git a/uart_commands.c b/uart_commands.c index 7144c1d..ad922ec 100644 --- a/uart_commands.c +++ b/uart_commands.c @@ -121,20 +121,25 @@ void uart_commands_getid(error_code* status){ void uart_commands_getserial(error_code* status){ - char hex[40] = "0x8005018af27a5225a541628f50020c0\r\n"; + //char hex[40] = "0x8005018af27a5225a541628f50020c0\r\n"; + char hex[40]; uint32_t res[4]; iap_read_serial(status, res); - /*digit_to_str(hex+1, res[0], 16); - digit_to_str(hex+9, res[1], 16); - digit_to_str(hex+17, res[2], 16); - digit_to_str(hex+25, res[3], 16);*/ + digit_to_str(hex+2, res[0], 16); hex[0]='0'; hex[1]='x'; - //sprintf(hex, "0x%x%x%x%x\r\n", res[0], res[1], res[2], res[3]); if(*status == 0){ uart_send_ok(); uart_send(hex, strlen(hex)); } + digit_to_str(hex, res[1], 16); + uart_send(hex, strlen(hex)); + digit_to_str(hex, res[2], 16); + uart_send(hex, strlen(hex)); + digit_to_str(hex, res[3], 16); + uart_send(hex, strlen(hex)); + uart_send("\r\n", 2); + //sprintf(hex, "0x%x%x%x%x\r\n", res[0], res[1], res[2], res[3]); } crc_t uart_commands_prog(error_code* status, int size){