修改以太网RMII接口GPIO引脚配置到高速模式
authorkyz <kongyuzhong@google.com>
Thu, 23 May 2024 03:32:06 +0000 (11:32 +0800)
committerkyz <kongyuzhong@google.com>
Thu, 23 May 2024 03:32:06 +0000 (11:32 +0800)
LWIP/Target/ethernetif.c
user/ht1622.c
user/user_eth.c

index 3afdc950d4a8d178f21f3cfeb10a95c3a318aab0..dbb4d991c9e6e6e722723e29b04d99140b4d6757 100644 (file)
@@ -625,21 +625,21 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef* ethHandle)
     GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5;
     GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
     GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
+    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
     GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
     HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 
     GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_7;
     GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
     GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
+    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
     GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
     HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 
     GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13;
     GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
     GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
+    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
     GPIO_InitStruct.Alternate = GPIO_AF11_ETH;
     HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
 
index 81c73cb23d13c1c22632cc7ddfe78c5cca975a35..a085efa0da8aa2cfc7c47477c49166bde2eefe06 100644 (file)
@@ -273,6 +273,21 @@ void lcd_init( void )
            //LCD Power ON
     lcd_power_on();
 
+#if 1
+       //Test LCD, for debug
+       volatile uint32_t test_ram_wr = 0x12345678;
+       volatile uint32_t test_ram_rd = 0;
+       
+         ht1622_ram_write( 0, &test_ram_wr, sizeof( test_ram_wr) );
+         ht1622_ram_read( 0, &test_ram_rd, sizeof( test_ram_rd ) );
+       
+         if( test_ram_wr == test_ram_rd ){
+                       printf( "ht122 lcd test ok, %02X\n", test_ram_wr);
+               }else{
+                       printf( "ht122 lcd test fail, %02X -- %02X\n", test_ram_wr, test_ram_rd );
+               }
+#endif
+
     ht1622_command( CMD_SYS_EN );
     memset( &g_disp_ram, 0xFF, sizeof( g_disp_ram ) ); //ALL ON
     ht1622_ram_write( 0, (uint8_t*)&g_disp_ram, 32 );
index c0edecd8a1c057d7153ccddef8bd0245d0e4ddec..6bdd880a1044604d0bc79554856b24fc59b5b865 100644 (file)
@@ -269,6 +269,23 @@ void user_eth_task( void* unused )
 
     uint32_t tcp_err_cnt = 0;
 
+       #if 0
+       //test eth output
+               while(1){
+                       if( netif_is_link_up(g_iot_client.p_netif) ){
+                               struct pbuf *p;
+                                       /* Allocate a new pbuf */
+                               p = pbuf_alloc(PBUF_LINK, 64, PBUF_RAM);
+                               if( p ){
+                                       for( int i=0; i<64; i++ )
+                                               ((uint8_t*)p->payload)[i] = i;
+                                               g_iot_client.p_netif->linkoutput( g_iot_client.p_netif,         p );
+                               }
+                       }
+                       osDelay( 5000 );
+               }
+               #endif
+
     while(1){
 
         //1. wait linkup