[SC64][SW] Fixed FPGA refresh

This commit is contained in:
Mateusz Faderewski 2023-01-21 03:44:26 +01:00
parent 038ef80fb7
commit 1d75948839
2 changed files with 8 additions and 23 deletions

View File

@ -36,7 +36,6 @@
#define LSC_READ_FEABITS (0xFB)
#define ISC_NOOP (0xFF)
#define ISC_ERASE_SRAM (1 << 16)
#define ISC_ERASE_FEATURE (1 << 17)
#define ISC_ERASE_CFG (1 << 18)
#define ISC_ERASE_UFM (1 << 19)
@ -189,11 +188,6 @@ static void lcmxo2_disable_flash (void) {
lcmxo2_execute_cmd(ISC_NOOP, 0xFFFFFF, CMD_NORMAL, NULL, 0, false);
}
static bool lcmxo2_erase_sram (void) {
lcmxo2_execute_cmd(ISC_ERASE, ISC_ERASE_SRAM, CMD_NORMAL, NULL, 0, false);
return lcmxo2_wait_busy();
}
static bool lcmxo2_erase_featbits (void) {
lcmxo2_execute_cmd(ISC_ERASE, ISC_ERASE_FEATURE, CMD_NORMAL, NULL, 0, false);
return lcmxo2_wait_busy();
@ -329,7 +323,6 @@ typedef enum {
CMD_RESTART = '$',
CMD_GET_DEVICE_ID = 'I',
CMD_ENABLE_FLASH = 'E',
CMD_DISABLE_FLASH = 'D',
CMD_ERASE_FLASH = 'X',
CMD_RESET_ADDRESS = 'A',
CMD_WRITE_PAGE = 'W',
@ -418,13 +411,6 @@ void vendor_initial_configuration (vendor_get_cmd_t get_cmd, vendor_send_respons
error = lcmxo2_enable_flash();
break;
case CMD_DISABLE_FLASH:
if (lcmxo2_read_status() & LSC_STATUS_CFG_ENABLE) {
error = lcmxo2_erase_sram();
lcmxo2_disable_flash();
}
break;
case CMD_ERASE_FLASH:
error = lcmxo2_erase_flash();
break;
@ -452,7 +438,7 @@ void vendor_initial_configuration (vendor_get_cmd_t get_cmd, vendor_send_respons
case CMD_REFRESH:
lcmxo2_refresh();
hw_delay_ms(100);
hw_delay_ms(200);
break;
default:

View File

@ -288,7 +288,6 @@ class LCMXO2Primer:
__CMD_RESTART = b'$'
__CMD_GET_DEVICE_ID = b'I'
__CMD_ENABLE_FLASH = b'E'
__CMD_DISABLE_FLASH = b'D'
__CMD_ERASE_FLASH = b'X'
__CMD_RESET_ADDRESS = b'A'
__CMD_WRITE_PAGE = b'W'
@ -322,17 +321,19 @@ class LCMXO2Primer:
self.__write(packet)
response = self.__read(5)
if (len(response) != 5):
raise LCMXO2PrimerException(f'No response received [{cmd}]')
length = int.from_bytes(response[4:5], byteorder='little')
response += self.__read(length)
calculated_checksum = crc32(response)
received_checksum = int.from_bytes(self.__read(4), byteorder='little')
if (response[0:3] != b'RSP'):
raise LCMXO2PrimerException('Invalid response token')
raise LCMXO2PrimerException(f'Invalid response token [{response[0:3]} / {cmd}]')
if (response[3:4] != cmd):
raise LCMXO2PrimerException('Invalid response command')
raise LCMXO2PrimerException(f'Invalid response command [{cmd} / {response[3]}]')
if (calculated_checksum != received_checksum):
raise LCMXO2PrimerException('Invalid response checksum')
raise LCMXO2PrimerException(f'Invalid response checksum [{cmd}]')
return response[5:]
@ -383,8 +384,6 @@ class LCMXO2Primer:
self.__cmd_execute(self.__CMD_PROGRAM_DONE)
self.__cmd_execute(self.__CMD_DISABLE_FLASH)
self.__cmd_execute(self.__CMD_REFRESH)
if (self.__cmd_execute(self.__CMD_PROBE_FPGA) != self.__FPGA_PROBE_VALUE):
@ -393,7 +392,7 @@ class LCMXO2Primer:
except LCMXO2PrimerException as e:
self.__cmd_execute(self.__CMD_ENABLE_FLASH)
self.__cmd_execute(self.__CMD_ERASE_FLASH)
self.__cmd_execute(self.__CMD_DISABLE_FLASH)
self.__cmd_execute(self.__CMD_REFRESH)
self.__cmd_execute(self.__CMD_RESTART)
raise LCMXO2PrimerException(e)
@ -402,7 +401,7 @@ class LCMXO2Primer:
class SC64BringUp:
__SERIAL_BAUD: int = 115200
__SERIAL_TIMEOUT: float = 16.0
__SERIAL_TIMEOUT: float = 6.0
__INTERVAL_TIME: float = 0.5
def __init__(self, progress: Callable[[int, int, str], None]) -> None: