diff options
Diffstat (limited to 'Software/Embedded_SW')
| -rw-r--r-- | Software/Embedded_SW/Embedded/DataDef.h | 1 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c | 8 | ||||
| -rw-r--r-- | Software/Embedded_SW/Embedded/Main.c | 42 |
3 files changed, 28 insertions, 23 deletions
diff --git a/Software/Embedded_SW/Embedded/DataDef.h b/Software/Embedded_SW/Embedded/DataDef.h index d8655296d..711a0ab95 100644 --- a/Software/Embedded_SW/Embedded/DataDef.h +++ b/Software/Embedded_SW/Embedded/DataDef.h @@ -37,6 +37,7 @@ //#define BTSR_ROTATED_WINDER_TFU //#define USE_UART4_FOR_BTSR // need change in FRPGA FPGA_1 yy > 0x20 + jumpers in main board need to read HW Version - no need when working only with stubs +//#define FORCE_BTSR_CARD_0023 // only for testing, include changes for BTSR without ASSY ID. use it with USE_UART4_FOR_BTSR //#define USE_RFID_STUB //stub only. to use it undef USE_RFID_LOGIC //#define RFID_READ_ONLY // diff --git a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c index c3ce35868..360eb3351 100644 --- a/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c +++ b/Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c @@ -1240,13 +1240,13 @@ char Read_HW_Version(unsigned char *Brd_ID, unsigned char *Assy_ID) if (ROM_GPIOPinRead(GPIO_PORTJ_BASE, GPIO_PIN_4) == GPIO_PIN_4) *Brd_ID |= 0x01; - if (ROM_GPIOPinRead(GPIO_PORTP_BASE, GPIO_PIN_3) == GPIO_PIN_3) + if (ROM_GPIOPinRead(GPIO_PORTP_BASE, GPIO_PIN_3) == GPIO_PIN_3)//ASSY_ID3 *Assy_ID |= 0x08; - if (ROM_GPIOPinRead(GPIO_PORTJ_BASE, GPIO_PIN_7) == GPIO_PIN_7) + if (ROM_GPIOPinRead(GPIO_PORTP_BASE, GPIO_PIN_5) == GPIO_PIN_5)//ASSY_ID2 *Assy_ID |= 0x04; - if (ROM_GPIOPinRead(GPIO_PORTS_BASE, GPIO_PIN_1) == GPIO_PIN_1) + if (ROM_GPIOPinRead(GPIO_PORTS_BASE, GPIO_PIN_1) == GPIO_PIN_1)//ASSY_ID1 *Assy_ID |= 0x02; - if (ROM_GPIOPinRead(GPIO_PORTP_BASE, GPIO_PIN_5) == GPIO_PIN_5) + if (ROM_GPIOPinRead(GPIO_PORTJ_BASE, GPIO_PIN_7) == GPIO_PIN_7)//ASSY_ID0 *Assy_ID |= 0x01; return PASSED; diff --git a/Software/Embedded_SW/Embedded/Main.c b/Software/Embedded_SW/Embedded/Main.c index c8e2e80b9..5d7def1d6 100644 --- a/Software/Embedded_SW/Embedded/Main.c +++ b/Software/Embedded_SW/Embedded/Main.c @@ -117,6 +117,8 @@ //***************************************************************************** static volatile uint32_t g_ui32SysTickCount = 0; +unsigned char Brd_ID = 0, Assy_ID = 0; + // Flags used to pass commands from interrupt context to the main loop. static volatile uint32_t g_ui32Flags; @@ -238,7 +240,7 @@ int main(void) { FRESULT Fresult = FR_OK; time_t time_store = 0; - unsigned char Brd_ID = 0, Assy_ID = 0; + // Enable interrupts to the processor. // ROM_IntMasterDisable(); @@ -357,21 +359,6 @@ int main(void) I2C_DispRFIDTask_Init();//I2C Task for dispensers & RFID - - Read_HW_Version(&Brd_ID, &Assy_ID); - - -#ifdef USE_UART4_FOR_BTSR - if(Assy_ID > 0) - { - BTSR_Init(); - } - else - { - ReportWithPackageFilter(ThreadFilter,"BTSR - ERROR: Wrong HW Version",__FILE__,__LINE__,(int)Brd_ID,RpError,(int)Assy_ID,0); - } -#endif - #if defined(USE_RFID_LOGIC) || defined(USE_RFID_STUB) //Trigger_RFID_Init(); //Init_IFS();//must be done after FPGA_Init Init_IFS(); @@ -409,9 +396,26 @@ int main(void) Trigger_RS485_Direction_Init();//init i/o } - #ifdef USE_UART4_FOR_BTSR - InitConsole_BTSR_UART4(ui32SysClock); - #endif + Read_HW_Version(&Brd_ID, &Assy_ID); + + if(Assy_ID > 4)//Bit2 = 1 for BTSR + { + InitConsole_BTSR_UART4(ui32SysClock); + + #ifdef USE_UART4_FOR_BTSR + BTSR_Init(); + #endif + } + else + { + #ifdef FORCE_BTSR_CARD_0023 + InitConsole_BTSR_UART4(ui32SysClock); + BTSR_Init(); + #endif + + ReportWithPackageFilter(ThreadFilter,"HW does NOT support BTSR",__FILE__,__LINE__,(int)Brd_ID,RpError,(int)Assy_ID,0); + } + //EMAC_initEMAC(); ControlInit(); |
