[SST25VF016B] improve error detection mechanism
This commit is contained in:
parent
01d4b75921
commit
107a454051
|
@ -34,6 +34,8 @@ void SST25VF016B_run_test(void)
|
|||
display_write_data_seq("/5 ");
|
||||
|
||||
switch (op_result) {
|
||||
case HAL_OK:
|
||||
break;
|
||||
case HAL_ERROR:
|
||||
display_write_data_seq("ERROR");
|
||||
break;
|
||||
|
@ -61,9 +63,35 @@ void SST25VF016B_run_test(void)
|
|||
display_write_data_byte('0' + err_count % 10);
|
||||
display_write_data_seq(" Errors");
|
||||
} else {
|
||||
for (size_t i = 0; i < 4; i += 2) {
|
||||
// odd reads MUST result in 0xBF
|
||||
if (rx_buffer[4+i] != 0xBF) {
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_byte('B');
|
||||
display_write_data_byte('1'+i);
|
||||
display_write_data_seq(" WRONG");
|
||||
goto write_retrieved_data;
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 1; i < 4; i += 2) {
|
||||
// even reads MUST result in 0x41
|
||||
if (rx_buffer[4+i] != 0x41) {
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_byte('B');
|
||||
display_write_data_byte('1'+i);
|
||||
display_write_data_seq(" WRONG");
|
||||
goto write_retrieved_data;
|
||||
}
|
||||
}
|
||||
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
DISPLAY_SET_CURSOR(1, 8);
|
||||
display_write_data_seq((char *) rx_buffer);
|
||||
}
|
||||
|
||||
write_retrieved_data:
|
||||
DISPLAY_SET_CURSOR(1, 12);
|
||||
display_write_data_seq((char *) &(rx_buffer[4]));
|
||||
|
||||
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_SET);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue