The Network Gateway device, which is a multi-purpose network device capable to interconnect CAN, RS485, USB, Ethernet and WiFi. The data pipes between endpoints are dynamically configurable via a web-based GUI.
2. 2
OBJECTIVE
Create a network device capable to interconnect multiple
communication interfaces:
CAN
RS485
USB (Communication Device Class a.k.a. VCOM)
Ethernet (UDP/TCP)
WiFi
3. 3
POSSIBLE USE-CASES OF THE DEVICE
data concentrator
network adaptation
debugging tool
learning tool
10. 5 . 2
IDE FOR FIRMWARE
EM::BLOCKS
is a free C/C++ IDE built to meet the most
demanding needs of its users working in the field of
embedded software development It is designed to be very
extensible and fully configurable.
Em::Blocks
11. 5 . 3
EMBEDDED WEB PAGES EDITOR
ATOM
is a text editor that's modern, approachable, yet
hackable to the core - a tool you can customize to do
anything but also use productively without ever touching a
config file.
Atom
12. 5 . 4
SOFTWARE STACKS
- TCP/UDP/IP Stack
- Open source RTOS
- HAL Layer
LwIP
FreeRTOS
STM32F2xx HAL drivers
13. 6 . 1
EMBEDDED WEB SERVER
Based on LwIP sockets
Runs in a separate thread
POST and GET methods implemented
Read-only file system contained
Used for configuration of data "pipes"
15. 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
16. 6 . 3
/ * *
* @ 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
17. 6 . 4
7
THANK YOUR FOR YOUR ATTENTION!
https://gitlab.com/OK2NMZ/NGW