从零开始使用CubeMX配置STM32使用lwip实现httpd服务器以及使用vscode编辑阅读keil代码(三)

VIP从零开始使用CubeMX配置STM32使用lwip实现httpd服务器以及使用vscode编辑阅读keil代码(三)
使用stm32搭载lwip实现HTTPd服务器
开通可读全文 ·5.9k 人阅读
最低0.47元/天 解锁文章

从零开始使用CubeMX配置STM32使用lwip实现httpd服务器

引言

在前两篇文章中自己介绍了如何配置freeRTOS以及如何配置LWIP,在这一章中,我们使用lwip实现一个httpd服务器,使浏览器可以访问。

自己写的另外两篇文章
从零开始Cubemx配置STM32搭载freeRTOS实现多路ADC(一)
从零开始Cubemx配置STM32搭载freeRTOS以及lwip实现tcp网络通信(二)
CubeMX配置STM32实现httpd服务器CGI功能并使用网页控制STM32单片机(四)

CubeMX配置HTTPD

lwip可以实现httpd,直接开启这个选项就可以了。
在这里插入图片描述
生成代码,开始这个代码不能使用,会发现在fs.c这个文件的#include HTTPD_FSDATA_FILE,这一句编译不过。发现cubemx生成的代码强制把HTTPD_FSDATA_FILE拓展到了"fsdata_custom.c",意思这让我们自己构建网页文件(我也不知道为什么这个选项不能修改),我们要把HTTPD_USE_CUSTOM_FSDATA以及LWIP_HTTPD_CUSTOM_FILES这个参数都改为0。就可以了,fsdata.c这个文件目录下有。

VIP LwIP+ STM32+HTTP 为解决服务器TimeWait多的问题,了解了一下TCP/IP协议的连接过程。 以访问一静态页面为例,从建立连接到访问拿到数据,然后关闭的整个过程。使用EtherPeek截图如下:图首为一次交互过程的总览,图中用圈圈+颜色标注了连接过程中数据的变化过程。非常清晰…… 建立连接: 1. 发起请求的一方,从发送syn(递交名片)包开始第一次握手。 2. 收到请求的一方立马回应ack包,发现这是新建 开通可读全文·6.2k 阅读·0 点赞·11 收藏 阅读全文

相关推荐

stm32F746实现HTTPD

发现cubemx生成的代码强制把HTTPD_FSDATA_FILE拓展到了"fsdata_custom.c",意思这让我们自己构建网页文件(我也不知道为什么这个选项不能修改),我们要把HTTPD_USE_CUSTOM_FSDATA以及LWIP_HTTPD_CUSTOM_FILES这个参数都改为0。生成代码,开始这个代码不能使用,会发现在fs.c这个文件的#include HTTPD_FSDATA_FILE,这一句编译不过。的情况下(能ping通你的开发板),先前写过,可参考一下。2、开启httpd服务。

1285

stm32h743 NetXduo 实现http server CubeIDE+CubeMX

同样,在FLASH.ld里面也要对应修改,增加.tcp_sec和 .nx_data两个区,我们用ram_d2区域去做网络,这个就是对应每个数据在d2区域的起点。在netxDuo里设置,在头文件里设置静态ip,我自己设置的是192.168.8.116。在CubeMX里,需要用到filex、dhcp和web_server,记得勾选上。在这边要设置mpu的大小,要用到http server,mpu得设置的大一些。在app_filex.c里删掉MX_FileX_Init多余的部分。我是这么设置的,做一个参考。

博客 1229

STM32 LWIP TCP客户端访问WEB实验(http格式)

本DEMO为工作项目的部分内容,STM32f107 作为TCP客户端访问WEB站点 ,使用http/1.1格式上传并获取WEB数据。附件WORD文档为项目的接口格式说明。 应用层:HTTP数据格式解析 MAX层:stm32f107 传输层:LWIP协议栈

FreeRTOS_HTTP_server:基于STM32的FreeRTOS HTTP Web服务器示例

基于STM32 HAL和FreeRTOS的HTTP Web服务器 基于FreeRTOS的简单HTTP服务器以及适用于Nucleo-F746ZG板的STM32 HAL库。 使用LwIP Netconn API。 它包含两个HTML页面: 第一页(主页)是静态的,它提供了有关STM32F7和LwIP堆栈的基本信息。 动态刷新第二页(每1秒钟),它显示运行时的RTOS统计信息。 如果有DHCP服务器可用,则可以通过启用DHCP进程来分配动态IP地址(在main.h中#define USE_DHCP)。 默认情况下,使用DHCP。 以太网电缆状态通过LED来确保: LED1:连接以太网电缆。 LED3:未连接以太网电缆。 笔记 该示例代码改编自ST Microelectronics的随附的“ LwIP HTTP Server Netconn RTOS”示例。 建造 此示例需要Make

CoppeliaSim(原V-REP)新手上路

CoppeliaSim(原V-REP)是一个机器人仿真平台,里面有很多来自别的公司的机器人模型以及完备的物理引擎,我们可以通过python,c++,matlab等语言控制里面的机器人。,您也可以在官网中Downloads里找您需要的版本,一般只需要下载EDU版本就可以了,我下载的是v4.1.0 windows EDU版本。在版本V4之前,CoppeliaSim叫V-REP,在官网可以下载到之前的V-REP版本。

qq_37051669的博客 4万+

思科路由器、交换机组网实验报告

通过思科模拟器搭建路由交换网络

ghj528的博客 1328

解密Android相机框架:从HAL到应用层的全链路解析

本文深入解析Android相机框架的全链路架构,从应用层到硬件抽象层(HAL)再到驱动层,详细介绍了CamX-CHI架构的设计哲学与实战应用。通过HAL3接口、V4L2交互机制及Camera2 API的最佳实践,帮助开发者优化相机性能,解决多摄切换、预览卡顿等常见问题,提升成像效率与稳定性。

weixin_29238147的博客 401

网络抓包实战:如何捕获与解析802.1Q VLAN标签报文

在网络通信中,数据包是信息传输的基本单元,而VLAN(虚拟局域网)技术通过在数据链路层插入802.1Q标签,实现了网络流量的逻辑隔离与高效管理。其核心原理是在标准以太网帧头中嵌入4字节的VLAN标识,使交换机能够根据VID(VLAN ID)进行精准转发。掌握VLAN报文的捕获与解析技术,对于网络故障排查、安全审计和性能优化具有重要价值,尤其在需要验证网络隔离策略或诊断Trunk链路异常时。本文聚焦于使用Wireshark工具,结合端口镜像等实操方法,详细演示如何抓取并解读携带802.1Q标签的原始报文,帮助

weixin_33417488的博客 379

利用正射影像对斜射图像进行反向投影

因此,RANSAC算法可以通过计算inliners和outliers的数量来评估估计关键点的质量,确保与其他点不一致的点不会在Homography矩阵中被估计。然后,它通过考虑关键点周围区域中图像的梯度大小和方向来计算每个提取的关键点的方向。由于单应性矩阵的计算可能会受到两个图像中异常值的存在的影响,这将导致矩阵的不正确估计并导致沿图像的对准和映射不良。FLANN匹配器的方法基于K近邻搜索的概念,即从图像中找到k个近邻。找到相机在正射影像坐标系中的位置并在正射影像上绘制重叠区域的边界框。

gis收藏家的博客 1502

《PCI Express体系结构导读1》-- PCI简介

请先阅读完一遍此书再来看文章哦,这样效率更高~

HoneyIC的博客 146

李航《统计学习方法》课后习题答案(第2版)

李航《统计学习方法》课后习题答案(第2版) 章节 链接 第1章 统计学习及监督学习概论 点击进入 第2章 感知机 点击进入 第3章 k近邻法 点击进入 第4章 朴素贝叶斯法 点击进入 第5章 决策树 点击进入 第6章 逻辑斯谛回归与最大熵 点击进入 第7章 支持向量机 点击进入 第8章 提升方法 点击进入 第9章 EM算法及其推广 点击进入 第10章 隐马尔可夫模型 点击进入 第11章 条件随机场 点击进入     也可进入我的个人主页查看分类专栏

weixin_43646592的博客 2万+

基于V7-690T FPGA纯逻辑实现NVMe SSD盘的读写(不使用软核)

a.NVMe的Admin CQ与Admin SQ命令放在Host内存中;因此SQ的64B要用FPGA的DDR或开一个bram空间存放,同理NVME写到HOST的CQ命令也需要存放在FPGA的DDR或一个bram空间,host收到NVME传来的MSI/MSI-X中断后,去CQ存放空间取CQ指令;b. 发送identify命令后,需要发送tial doorbell通知NVME;(发送CNS01h获取4096字节的固件信息等;发送CNS02h获取1024字节的namaspace list)

宝沐熙的博客 829

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

上一篇: 从零开始Cubemx配置STM32搭载freeRTOS以及lwip实现tcp网络通信(二)
下一篇: CubeMX配置STM32实现httpd服务器CGI功能并使用网页控制STM32单片机(四)

双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —
爱小羊
博客等级 码龄11年 173粉丝 26原创
评论 10
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值