network gateway
Post on 15-Apr-2017
179 Views
Preview:
TRANSCRIPT
2
OBJECTIVECreate a network device capable to interconnect multiplecommunication interfaces:
CANRS485USB (Communication Device Class a.k.a. VCOM)Ethernet (UDP/TCP)WiFi
3
POSSIBLE USE-CASES OF THE DEVICEdata concentratornetwork adaptationdebugging toollearning tool
4 . 1
HARDWARE
4 . 2
MICROCONTROLLERSTM32F207VFT6
ARM Cortex-M3 coreClock frequency - 120 MHzFlash memory - 768 kBOn chip SRAM - 128 kB2xCAN, 2xUART, 3xI2C, 3xSPI, 4xUSART, SDIO, ETHERNETPackage - LQFP100
4 . 3
WIFI MODULE - LPT100Wireless Standard 802.11 b/g/n
Frequency Range 2.412 GHz to 2.484 GHz
Transmit Power 16 dBm @ 802.11b14 dBm @ 802.11g13 dBm @ 802.11n
Data Interface UART, GPIO
Security Mechanisms WEP/WPA-PSK/WPA2-PSK
User Interface AT commands
4 . 4
OTHER INTERGRATED CIRCUITSEthernet PHY KSZ8081RNACA
CAN PHY MCP2551
RS485 PHY SN75176BD
MAC EEPROM 24AA02E48T
4 . 5
Image of the prototype
5 . 1
SOFTWARE
5 . 2
IDE FOR FIRMWAREEM::BLOCKS
is a free C/C++ IDE built to meet the mostdemanding needs of its users working in the field ofembedded software development It is designed to be veryextensible and fully configurable.
Em::Blocks
5 . 3
EMBEDDED WEB PAGES EDITORATOM
is a text editor that's modern, approachable, yethackable to the core - a tool you can customize to doanything but also use productively without ever touching aconfig file.
Atom
5 . 4
SOFTWARE STACKS - TCP/UDP/IP Stack
- Open source RTOS - HAL Layer
LwIPFreeRTOSSTM32F2xx HAL drivers
6 . 1
EMBEDDED WEB SERVERBased on LwIP socketsRuns in a separate threadPOST and GET methods implementedRead-only file system containedUsed for configuration of data "pipes"
6 . 2
Configuration page - show config
6 . 3
g e t _ f u n c t i o n h t t p _ g e t _ f u n c t i o n s [ ] ={ { " / " , g e t _ i n d e x , G E T _ N O _ H E A D E R | G E T _ N O _ F O O T E R , 2 } , { " / s t a t s . h t m l " , g e t _ s y s t e m _ s t a t u s , G E T _ S T A T I C _ L O A D _ A F T E R , 1 1 } , { " / f l s h . h t m l " , g e t _ c o n f i g , G E T _ N O _ H E A D E R | G E T _ N O _ F O O T E R , 1 0 } , { " / d n s . h t m l " , g e t _ d n s _ r e s o l v e , G E T _ N O _ H E A D E R | G E T _ N O _ F O O T E R , 9 } , / * C o m p a r i s o n a l w a y s m a t c h e s * / { " " , g e t _ s t a t i c _ o r _ 4 0 4 , G E T _ N O _ H E A D E R | G E T _ N O _ F O O T E R , 0 } ,} ;
p o s t _ f u n c t i o n h t t p _ p o s t _ f u n c t i o n s [ ] ={ { " w i f i T h r u " , p o s t _ w i f i _ t e s t , 8 } , { " u s b T h r u " , p o s t _ u s b _ t e s t , 7 } , { " R S 4 8 5 - 1 - d a t a " , p o s t _ r s 4 8 5 _ 1 _ t e s t , 1 2 } , { " R S 4 8 5 - 2 - d a t a " , p o s t _ r s 4 8 5 _ 2 _ t e s t , 1 2 } , { " c a n D a t a " , p o s t _ c a n _ t e s t , 7 } , { " E t h S e n d " , p o s t _ e t h _ s e n d , 7 } , { " f l a s h C f g " , p o s t _ u p l o a d _ c o n f i g , 8 } , / * I f n o t h i n g m a t c h e s , t h i s d o e s * / { " " , p o s t _ u n k n o w n _ f i e l d , 0 } ,} ;
simple to use
6 . 3
6 . 4
/ * * * @ b r i e f I n i t i a l i z e t h e H T T P s e r v e r ( s t a r t i t s t h r e a d ) * @ p a r a m n o n e * @ r e t v a l n o n e * /v o i d h t t p _ s e r v e r _ s o c k e t _ i n i t ( v o i d ){ s y s _ t h r e a d _ n e w ( " H T T P " , h t t p _ s e r v e r _ s o c k e t _ t h r e a d , N U L L , D E F A U L T _ T H R E A D _ S T A C K S I Z E , W E B S E R V E R _ T H R E A D _ P R I O ) ;}
... just call init and implement your callbacks
top related