lattice: fix bscan width and other minor things for NEXUS family

This commit is contained in:
Giovanni Bruni 2023-10-18 16:01:23 +02:00
parent dce0c050a7
commit 5f6074a7fc
1 changed files with 23 additions and 8 deletions

View File

@ -103,7 +103,7 @@ using namespace std;
# define REG_STATUS_AUTH_DONE (1 << 18) /* Authentication done */ # define REG_STATUS_AUTH_DONE (1 << 18) /* Authentication done */
# define REG_STATUS_PRI_BOOT_FAIL (1 << 21) /* Primary boot failure (1= Fail) even though secondary boot successful */ # define REG_STATUS_PRI_BOOT_FAIL (1 << 21) /* Primary boot failure (1= Fail) even though secondary boot successful */
# define REG_STATUS_CNF_CHK_MASK (0x0f << 23) /* Configuration Status Check */ # define REG_STATUS_CNF_CHK_MASK (0x0f << 23) /* Configuration Status Check */
#define REG_STATUS_PRV_CNF_CHK_MASK (0x0fUL << 33) /* NEXUS_FAMILY: Configuration Status Check of previous bitstrem */ #define REG_STATUS_PRV_CNF_CHK_MASK (0x0fUL << 34) /* NEXUS_FAMILY: Configuration Status Check of previous bitstrem */
# define REG_STATUS_MACHXO3D_CNF_CHK_MASK (0x0f << 22) /* Configuration Status Check */ # define REG_STATUS_MACHXO3D_CNF_CHK_MASK (0x0f << 22) /* Configuration Status Check */
# define REG_STATUS_EXEC_ERR (1 << 26) /*** NOT specified for MachXO3D ***/ # define REG_STATUS_EXEC_ERR (1 << 26) /*** NOT specified for MachXO3D ***/
# define REG_STATUS_DEV_VERIFIED (1 << 27) /* I=0 Device verified correct, I=1 Device failed to verify */ # define REG_STATUS_DEV_VERIFIED (1 << 27) /* I=0 Device verified correct, I=1 Device failed to verify */
@ -301,11 +301,20 @@ bool Lattice::program_mem()
displayReadReg(readStatusReg()); displayReadReg(readStatusReg());
} }
/* The command code 0x1C is not listed in the manual? */ /* The command code 0x1C is not listed in the manual?
/* preload 0x1C */ * PRELOAD/SAMPLE 0x1C
uint8_t tx_buf[26]; * For NEXUS family fpgas, the Bscan register is 362 bits long or
memset(tx_buf, 0xff, 26); * 45.25 bytes => 46 bytes
wr_rd(0x1C, tx_buf, 26, NULL, 0); */
uint8_t tx_buf[46];
memset(tx_buf, 0xff, 46);
int tx_len;
if(_fpga_family == NEXUS_FAMILY){
tx_len = 46;
} else {
tx_len = 26;
}
wr_rd(0x1C, tx_buf, tx_len, NULL, 0);
/* LSC_REFRESH 0x79 -- "Equivalent to toggle PROGRAMN pin" /* LSC_REFRESH 0x79 -- "Equivalent to toggle PROGRAMN pin"
* We REFRESH only if the fpga is in a status of error due to * We REFRESH only if the fpga is in a status of error due to
@ -375,9 +384,15 @@ bool Lattice::program_mem()
printSuccess("DONE"); printSuccess("DONE");
} }
/* ISC ERASE */ /* ISC ERASE
* For Nexus family (from svf file): 1 byte to tx 0x00
*/
printInfo("SRAM erase: ", false); printInfo("SRAM erase: ", false);
if (flashErase(FLASH_ERASE_SRAM) == false) { uint32_t mask_erase[1] = {FLASH_ERASE_SRAM};
if (_fpga_family == NEXUS_FAMILY){
mask_erase[0] = 0x00;
}
if (flashErase(mask_erase[0]) == false) {
printError("FAIL"); printError("FAIL");
displayReadReg(readStatusReg()); displayReadReg(readStatusReg());
return false; return false;