Hello,
i'm want to start a new project which use my own hardware. So i copied the demo project files and renamed it.
I can run this copied demo project on a AT91SAM7X-EK Board without problems.
Now i want to port the project to my own hardware which is a "modified" AT91SAM7X-EK Board.
My HW has the following peripheral:
- DM9161 PHY connected to the same pins like the AT91SAM7X-EK
- Mono GLCD with 2 KS108 Controller
-- Data Bus at PA19...PA26
-- Enable at PA27
-- R/W at PA28
-- RS at PA29
-- RST at PB28
- 4 LEDs (active LOW) at PA04...PA07
- 6 Buttons at PA14, PB27, PB20...PB23
- 8 GPIO OUTs at PA02, PA03, PA08, PA09, PA15...PA18 to switch Relais
- 1 DS1307
- 1 I2C Multiplexer for Analog Inputs
- 1 PWM OUT at PB29/PWM2
- 5 Analog Inputs at AD3...AD7
- 1 USB
Now i tried to modify the config.h for my project. I change the following:
#if defined _HW_SAM7X
#define TB_SAM7X
//#define SAM7X_EVAL // evaluation board from ATMEL
//#define OLIMEX_EX256 // low cost evaluation board from Olimex
#if defined (TB_SAM7X)
#define TARGET_HW "TB_SAM7X"
#elif defined (SAM7X_EVAL)
#define TARGET_HW "AT91SAM7X-EK"
#elif defined (OLIMEX_EX256)
#define TARGET_HW "SAM7X-EX256"
#endif
and disabled MODBUS, Serial Interface, SD-Card support:
//#define USE_MODBUS_SLAVE // slave capability supported
//#define USE_MODBUS_MASTER // master capabiity supported (either slave or master required)
//#define MODBUS_GATE_WAY_ROUTING // configurable routing from slave gateways (requires master functionality)
//#define MODBUS_GATE_WAY_QUEUE // support queuing of MODBUS transmissions - advisable for gateways
// #define MODBUS_DELAYED_RESPONSE // allow slave parameter interface to delay request responses - for example to prepare latest data from external location
// #define MAX_QUEUED_REQUEST_LENGTH 8 // longest request data length that needs to be saved when requests are delayed
//#define SERIAL_INTERFACE // enable serial interface driver
//#define SDCARD_SUPPORT // SD-card interface
I enabled the Mono GLCD with Samsung Controller:
#define SUPPORT_GLCD // enable the task for interfacing to a graphical LCD
#define _GLCD_SAMSUNG // Samsung controller based display rather than Toshiba
Now in app_hw_sam7x.h i make these changes:
I have no SPI Flash so i disabled it and patch the LCD to my port pins:
// #define SPI_FLASH_AT45DB321
#define DATA_LINES (PA26 | PA25 | PA24 | PA23 | PA22 | PA21 | PA20 | PA19)
#define GLCD_RST PB28 // reset
#define GLCD_RS PA29 // GLCD Register Select
#define GLCD_RW PA28 // GLCD Read/Write
#define GLCD_ENA PA27 // GLCD Enable
#define GLCD_CS0 PA12 // LCD Controller 0 Chip Select - 2 controller chips for 128 x 64
#define GLCD_CS1 PA13 // LCD Controller 1 Chip Select
#define SET_PULL_DOWNS()
#define REMOVE_PULL_DOWNS()
#define CONFIGURE_GLCD() \
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(A, ( GLCD_RS | GLCD_RW | GLCD_ENA | GLCD_CS0 | GLCD_CS1), GLCD_RW ); \
_CONFIG_DRIVE_PORT_OUTPUT_VALUE(B, GLCD_RST, GLCD_RW ); \
_CONFIG_PORT_INPUT(A, DATA_LINES);
#define GLCD_DATAASOUTPUT() _DRIVE_PORT_OUTPUT(A, DATA_LINES)
#define GLCD_DATAASINPUT() _FLOAT_PORT(A, DATA_LINES)
#define GLCD_DATAOUT(data) _WRITE_PORT_MASK(A, data, DATA_LINES)
#define GLCD_DATAIN() _READ_PORT_MASK(A, DATA_LINES)
#define GLCD_RS_H() _SETBITS(A, GLCD_RS)
#define GLCD_RS_L() _CLEARBITS(A, GLCD_RS)
#define GLCD_RW_H() _SETBITS(A, GLCD_RW)
#define GLCD_RW_L() _CLEARBITS(A, GLCD_RW)
#define GLCD_CS0_H() _SETBITS(A, GLCD_CS0)
#define GLCD_CS0_L() _CLEARBITS(A, GLCD_CS0)
#define GLCD_CS1_H() _SETBITS(A, GLCD_CS1)
#define GLCD_CS1_L() _CLEARBITS(A, GLCD_CS1)
#define GLCD_DELAY_WRITE() // no write delay since the data is stable for long enough at full speed
#define GLCD_DELAY_READ() GLCD_RW_H() // one extra operation to ensure set up time of read
#define GLCD_RST_H() _SETBITS(B, GLCD_RST)
#define GLCD_RST_L() _CLEARBITS(B, GLCD_RST)
#define GLCD_ENA_H() _SETBITS(A, GLCD_ENA)
#define GLCD_ENA_L() _CLEARBITS(A, GLCD_ENA)
#define MAX_GLCD_WRITE_BURST 80 // the maximum number of writes to the GLCD before the task yields
and defined my own HW:
#if defined (TB_SAM7X)
#define SHIFT_PORT_TO_BYTE 4
#define FIRST_USER_PORT PA04
#define DEMO_LED_1 (PA04 >> SHIFT_PORT_TO_BYTE)
#define DEMO_LED_2 (PA05 >> SHIFT_PORT_TO_BYTE)
#define DEMO_LED_3 (PA06 >> SHIFT_PORT_TO_BYTE)
#define DEMO_LED_4 (PA07 >> SHIFT_PORT_TO_BYTE)
#define DEMO_USER_PORTS (PA04 | PA05 | PA06 | PA07)
#define TEST_OUTPUT_LED PA05
#define BLINK_LED PA04
#define BLINK_LED_OUTPUT_STATE PIO_ODSR_A
#define BLINK_LED_CLR PIO_CODR_A
#define BLINK_LED_SET PIO_SODR_A
#define PHY_ADD_31 (PB04 | PB05 | PB06 | PB13 | PB14) // {7}
// DAVICON DM9161AE on ATMEL eval board
// remove pullup on TEST input (MII ERXDV) so that device goes to normal mode
// remove pullup on RMII input (MII ECOL) so that device uses MII mode
// drive power down mode to '0'
// drive PHY address to 0x1f (31) // {7}
#define DRIVE_PHY_OPTION_LINES() PIO_PUDR_B = (PB15 | PB16); PIO_PER_B = (PB18 | PHY_ADD_31); PIO_OER_B = (PB18 | PHY_ADD_31); PIO_CODR_B = PB18; \
PIO_SODR_B = (PHY_ADD_31); // {7}
#define PHY_INTERRUPT PB26
#define PHY_IDENTIFIER 0x0181b8a0 // DAVICON DM9161AE identifier
#define PHY_MASK 0xfffffff0
// SMTP settings
#define SENDERS_EMAIL_ADDRESS "AT91SAM7X-EK@uTasker.com" // fictional Email address of the board being used
#define EMAIL_SUBJECT "AT91SAM7X-EK Test" // Email subject
#define EMAIL_CONTENT "Hallo!!\r\nThis is an email message from the AT91SAM7X-EK.\r\nI hope that you have received this test and have fun using the uTasker operating system with integrated TCP/IP stack.\r\r\nRegards your AT91SAM7X-EK!!";
I change also the Timer Test LEds and the Watchdog LED:
#define TIMER_TEST_LED_1 PA06
#define TIMER_TEST_LED_2 PA07
#define CONFIG_TIMER_TEST_LEDS() PIO_SODR_A = (TIMER_TEST_LED_1 | TIMER_TEST_LED_2); PIO_OER_A = (TIMER_TEST_LED_1 | TIMER_TEST_LED_2); _SIM_PORTS
#define TIMER_TEST_LED_ON() PIO_CODR_A = (TIMER_TEST_LED_1); _SIM_PORTS
#define TIMER_TEST_LED2_ON() PIO_CODR_A = (TIMER_TEST_LED_2); _SIM_PORTS
#define TIMER_TEST_LED_OFF() PIO_SODR_A = (TIMER_TEST_LED_1); _SIM_PORTS
#define TIMER_TEST_LED2_OFF() PIO_SODR_A = (TIMER_TEST_LED_2); _SIM_PORTS
#ifdef USE_MAINTENANCE
#define INIT_WATCHDOG_LED() // we let the application configure all LEDs
#else
#define INIT_WATCHDOG_LED() _CONFIG_PORT_OUTPUT(A, BLINK_LED) // {26}
#endif
#if defined SUPPORT_GLCD && defined NOKIA_GLCD_MODE && defined OLIMEX_EX256 // {32}
#define TOGGLE_WATCHDOG_LED()
#else
#define TOGGLE_WATCHDOG_LED() _TOGGLE_PORT(A, BLINK_LED) // {26} blink the LED, if set as output
#endif
At this time i thought that i can see something on my LCD or see a LED toggle.
But nothing happens....
Have i forgotten something???
Thanks for your help!!
Volker