diff options
| author | wuyangyong <[email protected]> | 2011-10-11 02:57:51 +0000 |
|---|---|---|
| committer | wuyangyong <[email protected]> | 2011-10-11 02:57:51 +0000 |
| commit | c17931ad60b14f9447bbbfcde4df5db6079d3a8b (patch) | |
| tree | f04022c9c5360945c8e8f1595f65e7e5c4d2b250 | |
| parent | 91806b0420c3713c98d190029f2c09c860380edf (diff) | |
update enc28j60 driver. thank jeames:http://www.ourdev.cn/bbs/bbs_content.jsp?bbs_sn=4974037
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1753 bbd45198-f89e-11dd-88c7-29a3b14d5316
| -rw-r--r-- | bsp/stm32f10x/enc28j60.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/bsp/stm32f10x/enc28j60.c b/bsp/stm32f10x/enc28j60.c index 8c02ff1f7d..f3d5fddd97 100644 --- a/bsp/stm32f10x/enc28j60.c +++ b/bsp/stm32f10x/enc28j60.c @@ -332,6 +332,10 @@ void enc28j60_isr() /* TX Error handler */ if ((eir & EIR_TXERIF) != 0) { + enc28j60_set_bank(ECON1);
+ spi_write_op(ENC28J60_BIT_FIELD_SET, ECON1, ECON1_TXRST);
+ spi_write_op(ENC28J60_BIT_FIELD_CLR, ECON1, ECON1_TXRST);
+ enc28j60_set_bank(EIR);
spi_write_op(ENC28J60_BIT_FIELD_CLR, EIR, EIR_TXERIF); } @@ -673,9 +677,6 @@ static void NVIC_Configuration(void) { NVIC_InitTypeDef NVIC_InitStructure; - /* Configure one bit for preemption priority */ - NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1); - /* Enable the EXTI0 Interrupt */ NVIC_InitStructure.NVIC_IRQChannel = EXTI2_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; @@ -753,10 +754,12 @@ void rt_hw_enc28j60_init() enc28j60_dev_entry.parent.eth_rx = enc28j60_rx; enc28j60_dev_entry.parent.eth_tx = enc28j60_tx; - /* Update MAC address */ + /* Update MAC address */
+ /* OUI 00-04-A3 Microchip Technology, Inc. */ enc28j60_dev_entry.dev_addr[0] = 0x00; - enc28j60_dev_entry.dev_addr[1] = 0x30; - enc28j60_dev_entry.dev_addr[2] = 0x6c; + enc28j60_dev_entry.dev_addr[1] = 0x04; + enc28j60_dev_entry.dev_addr[2] = 0xA3;
+ /* generate MAC addr (only for test) */ enc28j60_dev_entry.dev_addr[3] = 0x11; enc28j60_dev_entry.dev_addr[4] = 0x22; enc28j60_dev_entry.dev_addr[5] = 0x33; |
