aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded
diff options
context:
space:
mode:
authorRonen Sberlo <ronen.s@twine-s.com>2021-01-04 17:25:25 +0200
committerRonen Sberlo <ronen.s@twine-s.com>2021-01-04 17:25:25 +0200
commit38904cb4e9d988c61198dbad41435c957156c07d (patch)
tree2df4aad293b629a7a5e7a3b64385ff196c5df6ea /Software/Embedded_SW/Embedded
parent53ba4a55863def0a69291c35acee36a9b51a317e (diff)
parent3e8135f99839a8ef6350ce3412cd752d3f3a48af (diff)
downloadTango-38904cb4e9d988c61198dbad41435c957156c07d.tar.gz
Tango-38904cb4e9d988c61198dbad41435c957156c07d.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded')
-rw-r--r--Software/Embedded_SW/Embedded/DataDef.h1
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/FPGA/FPGA_GPIO/FPGA_GPIO.c8
-rw-r--r--Software/Embedded_SW/Embedded/Main.c42
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();