lpc1678 test board

Board Features

Ethernet PHY and RJ-45
USB device using FTDI part on com:0
USB host and device connectors via on chip USB
2.4GHz RF transceiver via SPI (selectable EINT)
MicroSD card via SPI
Serial flash memory chip via SPI
Clock calendar chip via I2C (non mbed pins used) (selectable EINT)
Temp sensor chip via I2C (non mbed pins used) (selectable EINT)
8 pos dip switch via I2C (non mbed pins used)
Eeprom and MAC address via I2C (non mbed pins used)
JTAG programming header
Stereo codec
RS-232 transceiver and d-sub 9 on com:3 (non mbed pins used)
RS-485 transceiver and conn on com:1 (selectable)
CAN transceiver and conn on RD1/TD1 (non mbed pins used)
Header for external 3.3v & 5V I2C1 (non mbed pins used) (selectable EINT)
Header for external 3.3v & 5V I2C0 (non mbed pins used)
Header for optical incremental encoder
Header for 4 x 20 char lcd via I2C
Header for external SPI device
Header for unused processor pins
5" x 6" 4-layer pcb
Jack for +5v power input with on-board 3.3v regulator
2 headers for +/- 10v analog inputs
1 header for buffered analog output
2 headers for tachometer inputs using capture pins

This is the schematic of the board

/media/uploads/bobengle/lpc1678_test-board.pdf

This is the top of the board

/media/uploads/bobengle/picture_001.jpg

This is the bottom of the board

/media/uploads/bobengle/picture_002.jpg

The test program

main.cpp

#include        "mbed.h"
#include        "EthernetNetIf.h"
#include        "UDPSocket.h"
#include        "TCPSocket.h"
#include        "PortOut.h"
#include        "USBSerial.h"
#include        "bobs.h"

#define DHCP_ENABLE 1

Timer sendTimer;
DigitalOut      ds1(LED1);
DigitalOut      ds3(LED3);
Serial          pc(P4_28, P4_29);                                   // instantiate uart 1 (rs-232)
//USBSerial       pc;
CAN can2         (P0_21, P0_22);
I2C             i2c(P0_19, P0_20);                          // instantiate the i2c bus

//  24AA02E48 EEPROMs with EUI-48 Node Identity
#define _24AA02E48          0xA0
#define EUInode_BASE        0xFA

char        EUInode[] = {0,0,0,0,0,0}; 
union       bit_32 tmp;
char        i2c_buffer[64];

//
//  read value of the EUInode;
//
void read_EUInode(void) 
{
    i2c_buffer[0] = EUInode_BASE;
    i2c.write(_24AA02E48, i2c_buffer, 1);
    i2c.read(_24AA02E48, EUInode, 6);
}

int main() {
    int r;
    unsigned short t = 0;
    char sendBuffer[65];
    char i, p;
    
    CANMessage msg;
    can2.frequency(250000);
    pc.baud(57600);
    wait(30);
    ds3 = 1;
    pc.printf("MBED test board. \r\n");
    EthernetNetIf eth("");
    
    sendTimer.start();
    
    EthernetErr ethErr;
    TCPSocketErr tcpErr;
    UDPSocketErr udpErr;
    
    read_EUInode();
    //const char* hwAddr = eth.getHwAddr();
    const char* hwAddr = EUInode;
    pc.printf("HW address : %02x:%02x:%02x:%02x:%02x:%02x\r\n",
           hwAddr[0], hwAddr[1], hwAddr[2],
           hwAddr[3], hwAddr[4], hwAddr[5]);
           
    int count = 0;
    do {
        pc.printf("Setting up %d...\r\n", ++count);
        ethErr = eth.setup(30000);                             // !!!!!!!!!!!!!! ERROR: ALWAYS TIMES OUT !!!!!!!!!!!!!!
        if (ethErr) pc.printf("Timeout\r\n", ethErr);
        ds3 = !ds3;
    } while (ethErr != ETH_OK);

    pc.printf("Connected OK\r\n");


    IpAddr ethIp = eth.getIp();
    pc.printf("IP address : %d.%d.%d.%d\r\n", ethIp[0], ethIp[1], ethIp[2], ethIp[3]);
    pc.printf("Check router DHCP table for name : %s\r\n", eth.getHostname());
    
    Host destHost(IpAddr(172,16,152,111), 32, "");      // lab pc
    Host localHost(ethIp, 32, "MBED-TEST");

    UDPSocket udpSocket;
    udpErr = udpSocket.bind(destHost);
    pc.printf("udpSocket.bind result = %d\r\n", udpErr);
 
    for (;;) 
    {
        Net::poll();
        if(can2.read(msg)) 
        {
            tmp.u32 = msg.id;
            for(i = 0; i < 4; i++)
                sendBuffer[i] = tmp.u8[i];
            for(i = 0, p = 4; i < 8; i++, p++)
                sendBuffer[p] = msg.data[i];
            sendBuffer[12] = msg.len;
            r = udpSocket.sendto(sendBuffer, 13, &destHost);
            pc.printf("Can Message Sent\r\n");
        }
        if (sendTimer.read() > 5.0f)
        {    
            sprintf(sendBuffer, "%08x", t);
            r = udpSocket.sendto(sendBuffer, 8, &destHost);
            sendTimer.reset();
            pc.printf("%04x = %d\r\n", t++, r);
            ds1 = !ds1;
        }
    }   
}

/media/uploads/bobengle/mbed1.dsn_-_schematic1_-_page1.pdf


Please log in to post comments.