Browse Source

2022-02-25 / Wendell

Actions
1. add pcba test function
2. modify ddr frequency to 303(DS, DM, DW, DD, DO)

Files
1. As follow commit history

Image version: D0.00.XX.XXXX.XX
Wendell 3 years ago
parent
commit
af671b6d36

+ 420 - 0
EVSE/Modularization/Comm_Test.c

@@ -0,0 +1,420 @@
+/*
+ * Comm_Test.c
+ *
+ *  Created on: 2020¦~4¤ë20¤é
+ *      Author: Wendell
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "Comm_Test.h"
+#include "IO_Test.h"
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <linux/can.h>
+#include <linux/can/raw.h>
+#include <linux/wireless.h>
+#include <unistd.h>                 //write, close, usleep, read
+#include <string.h>
+
+#include <fcntl.h>                  //uart
+#include <termios.h>                //uart
+
+int Can0Fd, Can1Fd, LcmPort, RfidPort, InternalCommPort;
+char *LcmPortName = "/dev/ttyS3";
+char *RfidPortName = "/dev/ttyS2";
+char *InternalCommPortName = "/dev/ttyS5";
+
+//================================================
+// initial can-bus 0
+//================================================
+int InitCan0Bus()
+{
+    int                     s0,nbytes;
+    struct timeval          tv;
+    struct ifreq            ifr0;
+    struct sockaddr_can     addr0;
+
+    system("/sbin/ip link set can0 down");
+    system("/sbin/ip link set can0 type can bitrate 500000 restart-ms 100");
+    system("/sbin/ip link set can0 up");
+
+    s0 = socket(PF_CAN, SOCK_RAW, CAN_RAW);
+
+    tv.tv_sec = 0;
+    tv.tv_usec = 10000;
+    if (setsockopt(s0, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct  timeval)) < 0)
+    {
+        #ifdef SystemLogMessage
+        DEBUG_ERROR("Set SO_RCVTIMEO NG");
+        #endif
+    }
+    nbytes = 40960;
+    if (setsockopt(s0, SOL_SOCKET,  SO_RCVBUF, &nbytes, sizeof(int)) < 0)
+    {
+        #ifdef SystemLogMessage
+        DEBUG_ERROR("Set SO_RCVBUF NG");
+        #endif
+    }
+    nbytes = 40960;
+    if (setsockopt(s0, SOL_SOCKET, SO_SNDBUF, &nbytes, sizeof(int)) < 0)
+    {
+        #ifdef SystemLogMessage
+        DEBUG_ERROR("Set SO_SNDBUF NG");
+        #endif
+    }
+
+    strcpy(ifr0.ifr_name, "can0" );
+    ioctl(s0, SIOCGIFINDEX, &ifr0); /* ifr.ifr_ifindex gets filled with that device's index */
+    addr0.can_family = AF_CAN;
+    addr0.can_ifindex = ifr0.ifr_ifindex;
+    bind(s0, (struct sockaddr *)&addr0, sizeof(addr0));
+    return s0;
+}
+
+
+//================================================
+// initial can-bus 1
+//================================================
+int InitCan1Bus()
+{
+    int                     s0,nbytes;
+    struct timeval          tv;
+    struct ifreq            ifr0;
+    struct sockaddr_can     addr0;
+
+    system("/sbin/ip link set can1 down");
+    system("/sbin/ip link set can1 type can bitrate 500000 restart-ms 100");
+    system("/sbin/ip link set can1 up");
+
+    s0 = socket(PF_CAN, SOCK_RAW, CAN_RAW);
+
+    tv.tv_sec = 0;
+    tv.tv_usec = 10000;
+    if (setsockopt(s0, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct  timeval)) < 0)
+    {
+        #ifdef SystemLogMessage
+        PRINTF_LIB_FUNC("Set SO_RCVTIMEO NG");
+        #endif
+    }
+    nbytes = 40960;
+    if (setsockopt(s0, SOL_SOCKET,  SO_RCVBUF, &nbytes, sizeof(int)) < 0)
+    {
+        #ifdef SystemLogMessage
+        PRINTF_LIB_FUNC("Set SO_RCVBUF NG");
+        #endif
+    }
+    nbytes = 40960;
+    if (setsockopt(s0, SOL_SOCKET, SO_SNDBUF, &nbytes, sizeof(int)) < 0)
+    {
+        #ifdef SystemLogMessage
+        PRINTF_LIB_FUNC("Set SO_SNDBUF NG");
+        #endif
+    }
+
+    strcpy(ifr0.ifr_name, "can1" );
+    ioctl(s0, SIOCGIFINDEX, &ifr0); /* ifr.ifr_ifindex gets filled with that device's index */
+    addr0.can_family = AF_CAN;
+    addr0.can_ifindex = ifr0.ifr_ifindex;
+    bind(s0, (struct sockaddr *)&addr0, sizeof(addr0));
+    return s0;
+}
+
+void SendCan0Frame(int cmd, unsigned char *data, unsigned char dataLen)
+{
+    struct can_frame frame;
+
+    frame.can_id = cmd;
+    frame.can_dlc = dataLen;
+    memcpy(frame.data, data, sizeof(frame.data));
+
+    write(Can0Fd, &frame, sizeof(struct can_frame));
+}
+
+void SendCan1Frame(int cmd, unsigned char *data, unsigned char dataLen)
+{
+    struct can_frame frame;
+
+    frame.can_id = cmd;
+    frame.can_dlc = dataLen;
+    memcpy(frame.data, data, sizeof(frame.data));
+
+    write(Can1Fd, &frame, sizeof(struct can_frame));
+}
+
+void Can0TxMessageTest(void)
+{
+    int id = 0x80123456;
+    unsigned char data[8];
+
+    data[0] = 0x55;
+    data[1] = 0xAA;
+
+    SendCan0Frame(id, data, 2);
+}
+
+void Can1TxMessageTest(void)
+{
+    int id = 0x80654321;
+    unsigned char data[8];
+
+    data[0] = 0xAA;
+    data[1] = 0x55;
+
+    SendCan1Frame(id, data, 2);
+}
+
+//==========================================
+// Open LCM Port
+//==========================================
+int OpenLcmPort()
+{
+    int fd;
+    struct termios tios;
+
+    fd = open(LcmPortName, O_RDWR);
+    if (fd <= 0)
+    {
+        #ifdef SystemLogMessage
+        DEBUG_ERROR("open /dev/ttyS3 NG \n");
+        #endif
+        return -1;
+    }
+    ioctl(fd, TCGETS, &tios);
+    tios.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
+    tios.c_lflag = 0;
+    tios.c_iflag = 0;
+    tios.c_oflag = 0;
+    tios.c_cc[VMIN] = 0;
+    tios.c_cc[VTIME] = (unsigned char) 5;
+    tios.c_lflag = 0;
+    tcflush(fd, TCIFLUSH);
+    ioctl(fd, TCSETS, &tios);
+
+    return fd;
+}
+
+void CloseLcmPort()
+{
+    close(LcmPort);
+}
+
+//==========================================
+// Open RFID Port
+//==========================================
+int OpenRfidPort()
+{
+    int fd;
+    struct termios tios;
+
+    fd = open(RfidPortName, O_RDWR);
+    if (fd <= 0)
+    {
+        #ifdef SystemLogMessage
+        DEBUG_ERROR("open /dev/ttyS2 NG \n");
+        #endif
+        return -1;
+    }
+    ioctl(fd, TCGETS, &tios);
+    tios.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
+    tios.c_lflag = 0;
+    tios.c_iflag = 0;
+    tios.c_oflag = 0;
+    tios.c_cc[VMIN] = 0;
+    tios.c_cc[VTIME] = (unsigned char) 5;
+    tios.c_lflag = 0;
+    tcflush(fd, TCIFLUSH);
+    ioctl(fd, TCSETS, &tios);
+
+    return fd;
+}
+
+void CloseRfidPort()
+{
+    close(RfidPort);
+}
+
+void InitRS485DirectionIO(void)
+{
+    //LCD_AC_BIAS_EN    =>  GPIO2_25*//*RS-485 for module DE control
+    gpio_set_direction(PIN_AM_DE_1, GPIO_DIR_OUTPUT);
+    gpio_write(PIN_AM_DE_1, 1);
+    //system("echo 89 > /sys/class/gpio/export");
+    //system("echo \"out\" > /sys/class/gpio/gpio89/direction");
+    //system("echo 1 > /sys/class/gpio/gpio89/value");
+
+    //LCD_HSYNC     =>  GPIO2_23*//*RS-485 for module RE control
+    gpio_set_direction(PIN_AM_RE_1, GPIO_DIR_OUTPUT);
+    gpio_write(PIN_AM_RE_1, 0);
+    //system("echo 87 > /sys/class/gpio/export");
+    //system("echo \"out\" > /sys/class/gpio/gpio87/direction");
+    //system("echo 0 > /sys/class/gpio/gpio87/value");
+}
+
+//==========================================
+// Open Internal Comm Port
+//==========================================
+int OpenInternalCommPort()
+{
+    int fd;
+    struct termios tios;
+
+    fd = open(InternalCommPortName, O_RDWR);
+    if (fd <= 0)
+    {
+        #ifdef SystemLogMessage
+        DEBUG_ERROR("open /dev/ttyS5 NG \n");
+        #endif
+        return -1;
+    }
+    ioctl(fd, TCGETS, &tios);
+    tios.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
+    tios.c_lflag = 0;
+    tios.c_iflag = 0;
+    tios.c_oflag = 0;
+    tios.c_cc[VMIN] = 0;
+    tios.c_cc[VTIME] = (unsigned char) 5;
+    tios.c_lflag = 0;
+    tcflush(fd, TCIFLUSH);
+    ioctl(fd, TCSETS, &tios);
+
+    return fd;
+}
+
+void CloseInternalCommPort()
+{
+    close(InternalCommPort);
+}
+
+void DoDCMCommTest(void)
+{
+    struct can_frame frame;
+    int rxByte = 0;
+    unsigned char uartTx[2], uartRx[2];
+
+    Can0Fd = InitCan0Bus();
+    Can1Fd = InitCan1Bus();
+    LcmPort = OpenLcmPort();
+    RfidPort = OpenRfidPort();
+
+    InitRS485DirectionIO();
+    InternalCommPort = OpenInternalCommPort();
+
+    if(Can0Fd < 0)
+    {
+        printf("\r\nInit Can Bus 0 fail");
+        return;
+    }
+
+    if(Can1Fd < 0)
+    {
+        printf("\r\nInit Can Bus 1 fail");
+        return;
+    }
+
+    if(LcmPort < 0)
+    {
+        printf("\r\nInit LCM Port fail");
+        return;
+    }
+
+    if(RfidPort < 0)
+    {
+        printf("\r\nInit RFID Port fail");
+        return;
+    }
+
+    if(InternalCommPort < 0)
+    {
+        printf("\r\nInit Internal Comm Port fail");
+        return;
+    }
+
+    //*************************CAN Bus Test*************************
+    Can0TxMessageTest();
+    Can1TxMessageTest();
+
+    //usleep(10000);
+
+    rxByte = read(Can1Fd, &frame, sizeof(struct can_frame));
+
+    if(rxByte > 0 && frame.can_id == 0x80123456 && frame.data[0] == 0x55 && frame.data[1] == 0xAA)
+    {
+        printf("\r\nCan Bus 0 Tx OK");
+    }
+    else
+    {
+        printf("\r\nCan Bus 0 Tx Fail");
+        return;
+    }
+
+    rxByte = read(Can0Fd, &frame, sizeof(struct can_frame));
+
+    if(rxByte > 0 && frame.can_id == 0x80654321 && frame.data[0] == 0xAA && frame.data[1] == 0x55)
+    {
+        printf("\r\nCan Bus 1 Tx OK");
+    }
+    else
+    {
+        printf("\r\nCan Bus 1 Tx Fail");
+        return;
+    }
+
+    //*************************LCM UART Test*************************
+    uartTx[0] = 0x55;
+    uartTx[1] = 0xAA;
+
+    write(LcmPort, uartTx, 2);
+    rxByte = read(LcmPort, uartRx, 2);
+    CloseLcmPort();
+
+    if(rxByte == 2 && uartRx[0] == 0x55 && uartRx[1] == 0xAA)
+    {
+        printf("\r\nLCM Port Test OK");
+    }
+    else
+    {
+        printf("\r\nLCM Port Test Fail");
+        return;
+    }
+
+    //*************************RFID UART Test*************************
+    uartTx[0] = 0xAA;
+    uartTx[1] = 0x55;
+
+    write(RfidPort, uartTx, 2);
+    rxByte = read(RfidPort, uartRx, 2);
+    CloseRfidPort();
+
+    if(rxByte == 2 && uartRx[0] == 0xAA && uartRx[1] == 0x55)
+    {
+        printf("\r\nRFID Port Test OK");
+    }
+    else
+    {
+        printf("\r\nRFID Port Test Fail");
+        return;
+    }
+
+    //*************************Internal Comm RS485 Test*************************
+    uartTx[0] = 0x5A;
+    uartTx[1] = 0x5A;
+    write(InternalCommPort, uartTx, 2);
+    rxByte = read(InternalCommPort, uartRx, 2);
+    CloseInternalCommPort();
+
+    if(rxByte == 2 && uartRx[0] == 0x5A && uartRx[1] == 0x5A)
+    {
+        printf("\r\nInternal Comm Port Test OK");
+    }
+    else
+    {
+        printf("\r\nInternal Comm Port Test Fail");
+        return;
+    }
+
+    printf("\r\nComm Test Done!");
+    printf("\r\nSuccess!\r\n");
+
+}
+

+ 13 - 0
EVSE/Modularization/Comm_Test.h

@@ -0,0 +1,13 @@
+/*
+ * Comm_Test.h
+ *
+ *  Created on: 2020¦~4¤ë20¤é
+ *      Author: Wendell
+ */
+
+#ifndef COMM_TEST_H_
+#define COMM_TEST_H_
+
+void DoDCMCommTest(void);
+
+#endif /* COMM_TEST_H_ */

+ 87 - 0
EVSE/Modularization/Ethernet_Test.c

@@ -0,0 +1,87 @@
+/*
+ * Ethernet_Test.c
+ *
+ *  Created on: 2020¦~4¤ë21¤é
+ *      Author: Wendell
+ */
+
+#include "Ethernet_Test.h"
+#include "IO_Test.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>                 //write, close, usleep, read
+#include <string.h>
+
+void InitEthernetResetIO(void)
+{
+    /*MCASP0_ACLKX  =>  GPIO3_14*//*Ethernet PHY reset*/
+    gpio_set_direction(PIN_ETHERNET_RESET, GPIO_DIR_OUTPUT);
+    gpio_write(PIN_ETHERNET_RESET, 0);
+    usleep(100000);
+
+    gpio_write(PIN_ETHERNET_RESET, 1);
+    usleep(100000);
+}
+
+void EthernetDown(int channel)
+{
+    char tmpbuf[256];
+
+    memset(tmpbuf, 0, 256);
+    sprintf(tmpbuf, "/sbin/ifconfig eth%d down", channel > 0 ? 1 : 0);
+    system(tmpbuf);
+}
+
+void InitEthernet0(void)
+{
+    char tmpbuf[256];
+
+    //Init Eth0 for internet
+    memset(tmpbuf, 0, 256);
+    sprintf(tmpbuf, "/sbin/ifconfig eth0 %s netmask %s up", "192.168.1.10", "255.255.255.0");
+    system(tmpbuf);
+    //memset(tmpbuf,0,256);
+    //sprintf(tmpbuf,"route add default gw %s eth0 ", "192.168.1.254");
+    //system(tmpbuf);
+}
+
+void InitEthernet1(void)
+{
+    char tmpbuf[256];
+
+    //Init Eth1 for administrator tool
+    memset(tmpbuf, 0, 256);
+    sprintf(tmpbuf,"/sbin/ifconfig eth1 %s netmask %s up", "192.168.1.20", "255.255.255.0");
+    system(tmpbuf);
+    //memset(tmpbuf,0,256);
+    //sprintf(tmpbuf,"route add default gw %s eth1 ", "192.168.1.254");
+    //system(tmpbuf);
+}
+
+void DoEthernet0Test(void)
+{
+    InitEthernetResetIO();
+
+    EthernetDown(0);
+    EthernetDown(1);
+
+    InitEthernet0();
+
+    printf("\r\nEthernet 0 Test Done!");
+    printf("\r\nSuccess!\r\n");
+}
+
+void DoEthernet1Test(void)
+{
+    InitEthernetResetIO();
+
+    EthernetDown(0);
+    EthernetDown(1);
+
+    InitEthernet1();
+
+    printf("\r\nEthernet 1 Test Done!");
+    printf("\r\nSuccess!\r\n");
+}
+

+ 14 - 0
EVSE/Modularization/Ethernet_Test.h

@@ -0,0 +1,14 @@
+/*
+ * Ethernet_Test.h
+ *
+ *  Created on: 2020¦~4¤ë21¤é
+ *      Author: Wendell
+ */
+
+#ifndef ETHERNET_TEST_H_
+#define ETHERNET_TEST_H_
+
+void DoEthernet0Test(void);
+void DoEthernet1Test(void);
+
+#endif /* ETHERNET_TEST_H_ */

+ 317 - 0
EVSE/Modularization/IO_Test.c

@@ -0,0 +1,317 @@
+/*
+ * IO_Test.c
+ *
+ *  Created on: 2020¦~4¤ë21¤é
+ *      Author: Wendell
+ */
+
+#include "IO_Test.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>                 //write, close, usleep, read
+#include <fcntl.h>                  //uart
+
+const int System_GPIO_Pin_Table[SYS_GPIO_NUM] =
+{
+    PIN_AM_OK_FLAG, PIN_IO_BD1_1, PIN_IO_BD1_2, PIN_IO_BD2_1, PIN_IO_BD2_2, PIN_ID_BD1_1, PIN_ID_BD1_2, PIN_ID_BD2_1,
+    PIN_ID_BD2_2, PIN_AM_RFID_RST, PIN_AM_RFID_ICC, PIN_BOARD1_PROXIMITY, PIN_BOARD2_PROXIMITY, PIN_AM_DE_1, PIN_AM_RE_1, PIN_ETHERNET_RESET
+};
+
+void gpio_export(int pin)
+{
+    char buffer[64];
+
+    snprintf(buffer, sizeof(buffer), "echo %d > /sys/class/gpio/export", pin);
+    system(buffer);
+}
+
+void gpio_unexport(int pin)
+{
+    char buffer[64];
+
+    snprintf(buffer, sizeof(buffer), "echo %d > /sys/class/gpio/unexport", pin);
+    system(buffer);
+}
+
+void gpio_set_direction(int pin, unsigned char dir)
+{
+    /*
+    char buffer[64];
+
+    snprintf(buffer, sizeof(buffer), "echo %s > /sys/class/gpio/gpio%d/direction", dir == GPIO_DIR_INPUT ? "in" : "out", pin);
+    system(buffer);
+    */
+
+    int fd;
+    char buffer[64];
+
+    snprintf(buffer, sizeof(buffer), "/sys/class/gpio/gpio%d/direction", pin);
+    fd = open(buffer, O_WRONLY);
+    if (fd < 0)
+    {
+        gpio_export(pin);
+
+        fd = open(buffer, O_WRONLY);
+        if(fd < 0)
+        {
+            printf("\r\nFailed to open gpio%d direction for writing!", pin);
+            return;
+        }
+    }
+
+    write(fd, dir == GPIO_DIR_INPUT ? "in" : "out", dir == GPIO_DIR_INPUT ? 2 : 3);
+
+    close(fd);
+}
+
+void gpio_write(int pin, unsigned char value)
+{
+    char buffer[64];
+
+    snprintf(buffer, sizeof(buffer), "echo %d > /sys/class/gpio/gpio%d/value", value > 0 ? 1 : 0, pin);
+    system(buffer);
+}
+
+int gpio_read(int pin)
+{
+    int fd, value = 0;
+    char ch;
+    char buffer[64];
+
+    snprintf(buffer, sizeof(buffer), "/sys/class/gpio/gpio%d/value", pin);
+
+    fd = open(buffer, O_RDONLY);
+    if (fd < 0)
+    {
+        return -1;
+    }
+
+    if (read(fd, &ch, 4) < 0)
+    {
+        return -1;
+    }
+
+    value = atoi(&ch);
+
+    close(fd);
+    return value;
+}
+
+int adc_read(int adc_port)
+{
+    int fd, value = 0;
+    char ch[5];
+    char buffer[64];
+
+    snprintf(buffer,sizeof(buffer), "/sys/bus/iio/devices/iio:device0/in_voltage%d_raw", adc_port);
+    fd = open(buffer, O_RDONLY);
+
+    if(fd < 0)
+    {
+        return -1;
+    }
+
+    if(read(fd, ch, 4) < 0)
+    {
+        return -1;
+    }
+    value = atoi(ch);
+
+    close(fd);
+    return value;
+}
+
+void InitIO(void)
+{
+    /* GPMC_AD8         =>  GPIO0_22 *//*ID BD1_1*/
+    gpio_set_direction(PIN_ID_BD1_1, GPIO_DIR_INPUT);
+
+    /* GPMC_AD9         =>  GPIO0_23 *//*ID BD1_2*/
+    gpio_set_direction(PIN_ID_BD1_2, GPIO_DIR_INPUT);
+
+    /* GPMC_AD10        =>  GPIO0_26 *//*IO BD1_1*/
+    gpio_set_direction(PIN_IO_BD1_1, GPIO_DIR_OUTPUT);
+    gpio_write(PIN_IO_BD1_1, 0);
+
+    /* GPMC_AD11        =>  GPIO0_27 *//*IO BD1_2*/
+    gpio_set_direction(PIN_IO_BD1_2, GPIO_DIR_OUTPUT);
+    gpio_write(PIN_IO_BD1_2, 0);
+
+    /*XDMA_EVENT_INTR0  =>  GPIO0_19 *//*AM_RFID_RST*/
+    gpio_set_direction(PIN_AM_RFID_RST, GPIO_DIR_OUTPUT);
+    gpio_write(PIN_AM_RFID_RST, 0);
+
+    /*XDMA_EVENT_INTR1  =>  GPIO0_20 *//*AM_RFID_ICC*/
+    gpio_set_direction(PIN_AM_RFID_ICC, GPIO_DIR_OUTPUT);
+    gpio_write(PIN_AM_RFID_ICC, 0);
+
+    /* GPMC_AD12    =>  GPIO1_12 *//*ID BD2_1*/
+    gpio_set_direction(PIN_ID_BD2_1, GPIO_DIR_INPUT);
+
+    /* GPMC_AD13    =>  GPIO1_13 *//*ID BD2_2*/
+    gpio_set_direction(PIN_ID_BD2_2, GPIO_DIR_INPUT);
+
+    /* GPMC_AD14    =>  GPIO1_14 *//*IO BD2_1*/
+    gpio_set_direction(PIN_IO_BD2_1, GPIO_DIR_OUTPUT);
+    gpio_write(PIN_IO_BD2_1, 0);
+
+    /* GPMC_AD15    =>  GPIO1_15 *//*IO BD2_2*/
+    gpio_set_direction(PIN_IO_BD2_2, GPIO_DIR_OUTPUT);
+    gpio_write(PIN_IO_BD2_2, 0);
+
+    /* MCASP0_AXR0  =>  GPIO3_16 *//*CSU board function OK indicator.*/
+    gpio_set_direction(PIN_AM_OK_FLAG, GPIO_DIR_OUTPUT);
+    gpio_write(PIN_AM_OK_FLAG, 0);
+
+    gpio_set_direction(PIN_BOARD1_PROXIMITY, GPIO_DIR_INPUT);
+
+    gpio_set_direction(PIN_BOARD2_PROXIMITY, GPIO_DIR_INPUT);
+}
+
+void DeInitIO(void)
+{
+    gpio_unexport(PIN_ID_BD1_1);
+    gpio_unexport(PIN_ID_BD1_2);
+    gpio_unexport(PIN_IO_BD1_1);
+    gpio_unexport(PIN_IO_BD1_2);
+    gpio_unexport(PIN_AM_RFID_RST);
+    gpio_unexport(PIN_AM_RFID_ICC);
+    gpio_unexport(PIN_ID_BD2_1);
+    gpio_unexport(PIN_ID_BD2_2);
+    gpio_unexport(PIN_IO_BD2_1);
+    gpio_unexport(PIN_IO_BD2_2);
+    gpio_unexport(PIN_AM_OK_FLAG);
+}
+
+void DoIOTest(void)
+{
+    InitIO();
+
+    gpio_write(PIN_IO_BD1_1, 1);
+    if(gpio_read(PIN_ID_BD1_1) == 1)
+    {
+        gpio_write(PIN_IO_BD1_1, 0);
+        if(gpio_read(PIN_ID_BD1_1) == 0)
+        {
+            printf("\r\nID_BD1_1 Test OK");
+        }
+        else
+        {
+            printf("\r\nID_BD1_1 Low Test Fail");
+            return;
+        }
+    }
+    else
+    {
+        printf("\r\nID_BD1_1 High Test Fail");
+        return;
+    }
+
+    gpio_write(PIN_IO_BD1_2, 1);
+    if(gpio_read(PIN_ID_BD1_2) == 1)
+    {
+        gpio_write(PIN_IO_BD1_2, 0);
+        if(gpio_read(PIN_ID_BD1_2) == 0)
+        {
+            printf("\r\nID_BD1_2 Test OK");
+        }
+        else
+        {
+            printf("\r\nID_BD1_2 Low Test Fail");
+            return;
+        }
+    }
+    else
+    {
+        printf("\r\nID_BD1_2 High Test Fail");
+        return;
+    }
+
+    gpio_write(PIN_IO_BD2_1, 1);
+    if(gpio_read(PIN_ID_BD2_1) == 1)
+    {
+        gpio_write(PIN_IO_BD2_1, 0);
+        if(gpio_read(PIN_ID_BD2_1) == 0)
+        {
+            printf("\r\nID_BD2_1 Test OK");
+        }
+        else
+        {
+            printf("\r\nID_BD2_1 Low Test Fail");
+            return;
+        }
+    }
+    else
+    {
+        printf("\r\nID_BD2_1 High Test Fail");
+        return;
+    }
+
+    gpio_write(PIN_IO_BD2_2, 1);
+    if(gpio_read(PIN_ID_BD2_2) == 1)
+    {
+        gpio_write(PIN_IO_BD2_2, 0);
+        if(gpio_read(PIN_ID_BD2_2) == 0)
+        {
+            printf("\r\nID_BD2_2 Test OK");
+        }
+        else
+        {
+            printf("\r\nID_BD2_2 Low Test Fail");
+            return;
+        }
+    }
+    else
+    {
+        printf("\r\nID_BD2_2 High Test Fail");
+        return;
+    }
+
+    gpio_write(PIN_AM_RFID_RST, 1);
+    if(gpio_read(PIN_BOARD1_PROXIMITY) == 1 && gpio_read(PIN_BOARD2_PROXIMITY) == 1)
+    {
+        gpio_write(PIN_AM_RFID_RST, 0);
+        if(gpio_read(PIN_BOARD1_PROXIMITY) == 0 && gpio_read(PIN_BOARD2_PROXIMITY) == 0)
+        {
+            printf("\r\nBoard1 & Board2 Proximity Test OK");
+        }
+        else
+        {
+            printf("\r\nBoard1 & Board2 Proximity Low Test Fail");
+            return;
+        }
+    }
+    else
+    {
+        printf("\r\nBoard1 & Board2 Proximity High Test Fail");
+        return;
+    }
+
+    gpio_write(PIN_AM_RFID_ICC, 1);
+    usleep(100000);
+    if(adc_read(ADC_AIN0) < 100 && adc_read(ADC_AIN1) < 100 && adc_read(ADC_AIN2) < 100 && adc_read(ADC_AIN3) < 100)
+    {
+        gpio_write(PIN_AM_RFID_ICC, 0);
+        usleep(100000);
+        if(adc_read(ADC_AIN0) > 4000 && adc_read(ADC_AIN1) > 4000 && adc_read(ADC_AIN2) > 4000 && adc_read(ADC_AIN3) > 4000)
+        {
+            printf("\r\nAIN0, AIN1, AIN2, AIN3 Test OK");
+        }
+        else
+        {
+            printf("\r\nAIN0, AIN1, AIN2, AIN3 High Test Fail");
+            return;
+        }
+    }
+    else
+    {
+        printf("\r\nAIN0, AIN1, AIN2, AIN3 Low Test Fail");
+        return;
+    }
+
+    gpio_write(PIN_AM_OK_FLAG, 1);
+
+    printf("\r\nIO Test Done!");
+    printf("\r\nSuccess!\r\n");
+}

+ 63 - 0
EVSE/Modularization/IO_Test.h

@@ -0,0 +1,63 @@
+/*
+ * IO_Test.h
+ *
+ *  Created on: 2020¦~4¤ë21¤é
+ *      Author: Wendell
+ */
+
+#ifndef IO_TEST_H_
+#define IO_TEST_H_
+
+typedef enum
+{
+    GPIO_DIR_INPUT = 0,
+    GPIO_DIR_OUTPUT
+}_GPIO_DIR;
+
+typedef enum
+{
+    GPIO_AM_OK_FLAG = 0,                // output
+    GPIO_IO_BD1_1,                      // output
+    GPIO_IO_BD1_2,                      // output
+    GPIO_IO_BD2_1,                      // output
+    GPIO_IO_BD2_2,                      // output
+    GPIO_ID_BD1_1,                      // input
+    GPIO_ID_BD1_2,                      // input
+    GPIO_ID_BD2_1,                      // input
+    GPIO_ID_BD2_2,                      // input
+    GPIO_AM_RFID_RST,                   // output
+    GPIO_AM_RFID_ICC,                   // output
+    GPIO_BOARD1_PROXIMITY,              // input
+    GPIO_BOARD2_PROXIMITY,              // input
+}_SYS_GPIO;
+
+#define SYS_GPIO_NUM                    16
+
+#define PIN_AM_OK_FLAG                  112
+#define PIN_IO_BD1_1                    26
+#define PIN_IO_BD1_2                    27
+#define PIN_IO_BD2_1                    46
+#define PIN_IO_BD2_2                    47
+#define PIN_ID_BD1_1                    22
+#define PIN_ID_BD1_2                    23
+#define PIN_ID_BD2_1                    44
+#define PIN_ID_BD2_2                    45
+#define PIN_AM_RFID_RST                 19
+#define PIN_AM_RFID_ICC                 20
+#define PIN_BOARD1_PROXIMITY            88
+#define PIN_BOARD2_PROXIMITY            86
+#define PIN_AM_DE_1                     89
+#define PIN_AM_RE_1                     87
+#define PIN_ETHERNET_RESET              110
+
+#define ADC_AIN0                        0
+#define ADC_AIN1                        1
+#define ADC_AIN2                        2
+#define ADC_AIN3                        3
+
+void gpio_set_direction(int pin, unsigned char dir);
+void gpio_write(int pin, unsigned char value);
+int gpio_read(int pin);
+void DoIOTest(void);
+
+#endif /* IO_TEST_H_ */

+ 54 - 0
EVSE/Modularization/Module_PCBTest.c

@@ -0,0 +1,54 @@
+/*
+ * Module_PCBTest.c
+ *
+ *  Created on: 2020¦~5¤ë17¤é
+ *      Author: Wendell
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "Module_PCBTest.h"
+#include "Comm_Test.h"
+#include "PrimaryMCU_Test.h"
+#include "IO_Test.h"
+#include "Storage_Test.h"
+#include "Ethernet_Test.h"
+
+TestItem const TestList[] =
+{
+	    { 4, "Communication Test",          "comm",             DoDCMCommTest},
+	    { 4, "Ethernet 0 Test",             "eth0",             DoEthernet0Test},
+	    { 4, "Ethernet 1 Test",             "eth1",             DoEthernet1Test},
+	    { 7, "Primary MCU Test",            "primary",          DoPrimaryMCUTest},
+	    { 2, "Digital & Analog IO Test",    "io",               DoIOTest},
+	    { 7, "Storage Test",                "storage",          DoStorageTest},
+	    { 0, "",                            "",                 0}
+};
+
+int main(int argc, char *argv[])
+{
+	const TestItem *tItem;
+
+	if(argc > 1)
+	{
+        for(tItem = TestList; tItem->CmdStrLen; tItem++)
+        {
+            if(strncmp(tItem->Cmd, argv[1], tItem->CmdStrLen) == 0)
+            {
+                printf("\r\nDCM %s Start", tItem->Name); /* prints !!!Hello World!!! */
+                (*tItem->fnCmd)();
+                break;
+            }
+        }
+	}
+	else
+	{
+	    printf("\r\nNeed Some Parameter");
+	}
+
+	printf("\r\n");
+
+	return 0;
+}

+ 19 - 0
EVSE/Modularization/Module_PCBTest.h

@@ -0,0 +1,19 @@
+/*
+ * Module_PCBTest.h
+ *
+ *  Created on: 2020Ś~5¤ë17¤é
+ *      Author: Wendell
+ */
+
+#ifndef MODULE_PCBTEST_H_
+#define MODULE_PCBTEST_H_
+
+typedef struct
+{
+    unsigned char CmdStrLen;           /* command length. */
+    char const *Name;
+    char const *Cmd;
+    void (*fnCmd)(void);
+}TestItem;
+
+#endif /* MODULE_PCBTEST_H_ */

+ 242 - 0
EVSE/Modularization/PrimaryMCU_Test.c

@@ -0,0 +1,242 @@
+/*
+ * PrimaryMCU_Test.c
+ *
+ *  Created on: 2020¦~4¤ë21¤é
+ *      Author: Wendell
+ */
+
+#include "PrimaryMCU_Test.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <unistd.h>                 //write, close, usleep, read
+#include <sys/ioctl.h>
+#include <fcntl.h>                  //uart
+#include <termios.h>                //uart
+
+int PrimaryMcuPort;
+char *PrimaryPortName = "/dev/ttyS1";
+
+//================================================
+// Open Primary MCU Port
+//================================================
+int OpenPrimaryMcuPort()
+{
+    int fd;
+    struct termios tios;
+
+    fd = open(PrimaryPortName, O_RDWR);
+    if(fd<=0)
+    {
+        #ifdef SystemLogMessage
+        DEBUG_ERROR("open 407 Communication port NG \n");
+        #endif
+        return -1;
+    }
+    ioctl (fd, TCGETS, &tios);
+    tios.c_cflag = B115200| CS8 | CLOCAL | CREAD;
+    tios.c_lflag = 0;
+    tios.c_iflag = 0;
+    tios.c_oflag = 0;
+    tios.c_cc[VMIN]=0;
+    tios.c_cc[VTIME]=(unsigned char)1;
+    tios.c_lflag=0;
+    tcflush(fd, TCIFLUSH);
+    ioctl (fd, TCSETS, &tios);
+
+    return fd;
+}
+
+void ClosePrimaryPort()
+{
+    close(PrimaryMcuPort);
+}
+
+unsigned char Query_FW_Ver(void)
+{
+    int i = 0;
+    unsigned char result = 0;
+    unsigned char tx[7] = {0xaa, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len;
+
+    tcflush(PrimaryMcuPort, TCIOFLUSH);
+    write(PrimaryMcuPort, tx, 7);
+    usleep(50000);
+    len = read(PrimaryMcuPort, rx, 512);
+
+    if(len > 0)
+    {
+        for(i = 0; i < (rx[4] | rx[5]<<8); i++)
+        {
+            chksum ^= rx[6 + i];
+        }
+
+        if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+           (rx[2] == tx[1]) &&
+           (rx[1] == tx[2]) &&
+           (rx[3] == tx[3]))
+        {
+            //printf("\r\nPrimary Rx:");
+            //for(i = 0; i < len; i++)
+            //{
+            //    printf(" %02X", rx[i]);
+            //}
+
+            printf("\r\nPrimary FW: %s", &rx[6]);
+
+            result = 1;
+        }
+    }
+
+    return result;
+}
+
+unsigned char Run_Self_Test_Item(uint8_t *accept)
+{
+    int i = 0;
+    unsigned char result = 0;
+    unsigned char tx[8] = {0xaa, 0x00, 0x04, 0x92, 0x01, 0x00, 0x01, 0x01};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len;
+
+    tcflush(PrimaryMcuPort, TCIOFLUSH);
+    write(PrimaryMcuPort, tx, 8);
+    usleep(50000);
+    len = read(PrimaryMcuPort, rx, 512);
+
+    *accept = 0;
+
+    if(len > 0)
+    {
+        for(i = 0; i < (rx[4] | rx[5]<<8); i++)
+        {
+            chksum ^= rx[6 + i];
+        }
+
+        if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+           (rx[2] == tx[1]) &&
+           (rx[1] == tx[2]) &&
+           (rx[3] == tx[3]))
+        {
+            *accept = rx[6];
+
+            //printf("\r\nSelf Test Rx:");
+            //for(i = 0; i < len; i++)
+            //{
+            //    printf(" %02X", rx[i]);
+            //}
+
+            result = 1;
+        }
+    }
+
+    return result;
+}
+
+unsigned char Get_Self_Test_Result(uint8_t *status, uint16_t *fail)
+{
+    int i = 0;
+    unsigned char result = 0;
+    unsigned char tx[7] = {0xaa, 0x00, 0x04, 0x32, 0x00, 0x00, 0x00};
+    unsigned char rx[512];
+    unsigned char chksum = 0x00;
+    unsigned char len;
+
+    tcflush(PrimaryMcuPort, TCIOFLUSH);
+    write(PrimaryMcuPort, tx, 7);
+    usleep(50000);
+    len = read(PrimaryMcuPort, rx, 512);
+
+    if(len > 0)
+    {
+        for(i = 0; i < (rx[4] | rx[5]<<8); i++)
+        {
+            chksum ^= rx[6 + i];
+        }
+
+        if((chksum == rx[6+(rx[4] | rx[5]<<8)]) &&
+           (rx[2] == tx[1]) &&
+           (rx[1] == tx[2]) &&
+           (rx[3] == tx[3]))
+        {
+            *status = rx[6];
+            *fail = rx[7] + (rx[8] << 8);
+
+            //printf("\r\nTest Result Rx:");
+            //for(i = 0; i < len; i++)
+            //{
+            //    printf(" %02X", rx[i]);
+            //}
+
+            result = 1;
+        }
+    }
+
+    return result;
+}
+
+void DoPrimaryMCUTest(void)
+{
+    int i = 0;
+    uint8_t accept = 0, status = 0;
+    uint16_t fail_item = 0;
+
+    PrimaryMcuPort = OpenPrimaryMcuPort();
+
+    if(Run_Self_Test_Item(&accept) == 0)
+    {
+        usleep(100000);
+
+        if(Run_Self_Test_Item(&accept) == 0)
+        {
+            ClosePrimaryPort();
+            printf("\r\nPrimary Run Self Test Fail");
+            return;
+        }
+    }
+
+    if(accept == 0)
+    {
+        printf("\r\nSelf Test Reject, Test Fail");
+        ClosePrimaryPort();
+        return;
+    }
+
+    for(i = 0; i < 100; i++)
+    {
+        status = 0;
+        fail_item = 0;
+        Get_Self_Test_Result(&status, &fail_item);
+
+        if(status == 2)
+        {
+            usleep(100000);
+        }
+        else
+        {
+            break;
+        }
+    }
+
+    ClosePrimaryPort();
+
+    if(status == 0)
+    {
+        printf("\r\nSelf Test Fail, Fail Item: 0x%04X", fail_item);
+        return;
+    }
+    else if(status != 1)
+    {
+        printf("\r\nSelf Test Fail, Timeout");
+        return;
+    }
+
+    printf("\r\nPrimary MCU Self Test OK");
+
+    printf("\r\nPrimary Test Done!");
+    printf("\r\nSuccess!\r\n");
+}

+ 13 - 0
EVSE/Modularization/PrimaryMCU_Test.h

@@ -0,0 +1,13 @@
+/*
+ * PrimaryMCU_Test.h
+ *
+ *  Created on: 2020Ś~4¤ë21¤é
+ *      Author: Wendell
+ */
+
+#ifndef PRIMARYMCU_TEST_H_
+#define PRIMARYMCU_TEST_H_
+
+void DoPrimaryMCUTest(void);
+
+#endif /* PRIMARYMCU_TEST_H_ */

+ 164 - 0
EVSE/Modularization/Storage_Test.c

@@ -0,0 +1,164 @@
+/*
+ * Storage_Test.c
+ *
+ *  Created on: 2020¦~4¤ë21¤é
+ *      Author: Wendell
+ */
+
+#include "Storage_Test.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>                 //write, close, usleep, read
+#include <fcntl.h>                  //uart
+#include <string.h>
+
+void Mount_SD_Card_to_MMT(void)
+{
+    system("mount /dev/mmcblk0p1 /mnt");
+}
+
+void Write_To_SD_Card(void)
+{
+    system("echo sd card write test > /mnt/sd_test.txt");
+}
+
+void Unmount_SD_Card_From_MMT(void)
+{
+    system("umount /mnt");
+}
+
+void Mount_SD_Card_to_UsbFlash(void)
+{
+    system("mount /dev/mmcblk0p1 /UsbFlash");
+}
+
+int Is_SD_Card_Write_OK(void)
+{
+    int result = 0;
+    FILE *fp;
+    char buf[512];
+
+    fp = fopen("/UsbFlash/sd_test.txt", "r");
+    if(fp == NULL)
+    {
+        return result;
+    }
+    else
+    {
+        while(fgets(buf, sizeof(buf), fp) != NULL)
+        {
+            if(strncmp(buf, "sd card write test", 18) == 0)
+            {
+                result = 1;
+            }
+        }
+    }
+    fclose(fp);
+
+    return result;
+}
+
+void Remove_SD_Card_File_From_UsbFlash(void)
+{
+    system("rm /UsbFlash/sd_test.txt -f");
+}
+
+void Unmount_SD_Card_From_UsbFlash(void)
+{
+    system("umount /UsbFlash");
+}
+
+void Mount_USB_to_MMT(void)
+{
+    system("mount /dev/sda1 /mnt");
+}
+
+void Write_To_USB(void)
+{
+    system("echo usb write test > /mnt/usb_test.txt");
+}
+
+void Unmount_USB_From_MMT(void)
+{
+    system("umount /mnt");
+}
+
+void Mount_USB_to_UsbFlash(void)
+{
+    system("mount /dev/sda1 /UsbFlash");
+}
+
+int Is_USB_Write_OK(void)
+{
+    int result = 0;
+    FILE *fp;
+    char buf[512];
+
+    fp = fopen("/UsbFlash/usb_test.txt", "r");
+    if(fp == NULL)
+    {
+        return result;
+    }
+    else
+    {
+        while(fgets(buf, sizeof(buf), fp) != NULL)
+        {
+            if(strncmp(buf, "usb write test", 14) == 0)
+            {
+                result = 1;
+            }
+        }
+    }
+    fclose(fp);
+
+    return result;
+}
+
+void Remove_USB_File_From_UsbFlash(void)
+{
+    system("rm /UsbFlash/usb_test.txt -f");
+}
+
+void Unmount_USB_From_UsbFlash(void)
+{
+    system("umount /UsbFlash");
+}
+
+void DoStorageTest(void)
+{
+    Mount_SD_Card_to_MMT();
+    Write_To_SD_Card();
+    Unmount_SD_Card_From_MMT();
+
+    Mount_SD_Card_to_UsbFlash();
+    if(Is_SD_Card_Write_OK() == 0)
+    {
+        printf("\r\nSD Card Write Test Fail");
+        Remove_SD_Card_File_From_UsbFlash();
+        Unmount_SD_Card_From_UsbFlash();
+        return;
+    }
+    printf("\r\nSD Card Write Test OK");
+    Remove_SD_Card_File_From_UsbFlash();
+    Unmount_SD_Card_From_UsbFlash();
+
+    Mount_USB_to_MMT();
+    Write_To_USB();
+    Unmount_USB_From_MMT();
+
+    Mount_USB_to_UsbFlash();
+    if(Is_USB_Write_OK() == 0)
+    {
+        printf("\r\nUSB Write Test Fail");
+        Remove_USB_File_From_UsbFlash();
+        Unmount_USB_From_UsbFlash();
+        return;
+    }
+    printf("\r\nUSB Write Test OK");
+    Remove_USB_File_From_UsbFlash();
+    Unmount_USB_From_UsbFlash();
+
+    printf("\r\nStorage Test Done!");
+    printf("\r\nSuccess!\r\n");
+}

+ 13 - 0
EVSE/Modularization/Storage_Test.h

@@ -0,0 +1,13 @@
+/*
+ * Storge_Test.h
+ *
+ *  Created on: 2020¦~4¤ë21¤é
+ *      Author: Wendell
+ */
+
+#ifndef STORAGE_TEST_H_
+#define STORAGE_TEST_H_
+
+void DoStorageTest(void);
+
+#endif /* STORAGE_TEST_H_ */

BIN
EVSE/rootfs/root/Module_PCBTest


+ 12 - 12
Makefile

@@ -98,7 +98,7 @@ DD360-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DD360]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_400
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_303
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DD360/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DD360/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/DD360/Images/
@@ -279,7 +279,7 @@ DM30-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DM30]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_400
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_303
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DM30/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DM30/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/DM30/Images/
@@ -375,7 +375,7 @@ DW30-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DW30]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_400
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_303
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DW30/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DW30/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/DW30/Images/
@@ -475,7 +475,7 @@ DS60-120-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DS60-120]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_400
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_303
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DS60-120/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DS60-120/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/DS60-120/Images/
@@ -1116,7 +1116,7 @@ PlugIt360-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[PlugIt360]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_400
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_303
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/PlugIt360/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/PlugIt360/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/PlugIt360/Images/
@@ -1261,7 +1261,7 @@ DO360-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DO360]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_400
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_303
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DO360/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DO360/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/DO360/Images/
@@ -1407,7 +1407,7 @@ Zanobe-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[Zanobe]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_400
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_303
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/Zanobe/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/Zanobe/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/Zanobe/Images/
@@ -1480,7 +1480,7 @@ e4you-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[e4you]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_400
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_303
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/e4you/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/e4you/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/e4you/Images/
@@ -1553,7 +1553,7 @@ DD360Audi-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DD360Audi]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_400
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_303
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DD360Audi/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DD360Audi/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/DD360Audi/Images/
@@ -1801,7 +1801,7 @@ DD360UCar-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DD360UCar]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_400
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_303
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DD360UCar/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DD360UCar/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/DD360UCar/Images/
@@ -1874,7 +1874,7 @@ DD360Tcci-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DD360Tcci]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_400
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_303
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DD360Tcci/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DD360Tcci/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/DD360Tcci/Images/
@@ -1947,7 +1947,7 @@ DD360Tcci-uboot:
 	@echo    Building U-boot
 	@echo ===================================
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/[DD360Tcci]am335x-evm.dts board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/arch/arm/dts/am335x-evm.dts
-	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_400
+	$(MAKE) -j $(MAKE_JOBS) -C $(TI_SDK_PATH)/board-support/u-boot-* CROSS_COMPILE=$(CROSS_COMPILE) FLASH_IC=MT29F16G08_BCH16 DDR_IC=MT41K256M16HA125E_303
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/MLO EVSE/Projects/DD360Tcci/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/u-boot.img EVSE/Projects/DD360Tcci/Images/
 	@cp -f board-support/u-boot-2017.01+gitAUTOINC+340fb36f04-g340fb36f04/spl/u-boot-spl.bin EVSE/Projects/DD360Tcci/Images/