完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,
我正在使用SPWF01SA1模块使用POST请求将数据从我的应用程序发送到中央服务器。 我需要使用单个POST请求传输64 kByte的二进制数据(application / octet-stream),因为我希望目标服务器接收单个传输命令,必须对其进行验证并确认回来以便正确接收。 我已经看到AT + S.HTTPPOST命令对最大长度有限制所以我不能使用它。 然后我将固件升级到版本3.5以尝试命令AT + S.HTTPREQ,构建我自己的POST头并能够在命令后发送数据。 通过这种方式,我设法发送了不到12 kByte的东西。在传输过程中,RTS信号每1024字节升一次,所以我插入一个暂停让缓冲区刷新。无论我在HTTPREQ命令和数据之间等待多长时间(我应该等待吗?)还是在RTS信号之间等待(所有这些信号都保持解除固定时间小于3.5毫秒并且我将暂停时间提高到1秒):当数据量为11460字节或更多时,数据包将无法到达目的地,而11440字节的数据一切正常。 我目前的测试目的地是posttestserver.com,在那里我发现了几千字节(甚至一个略小于1 MByte)的存储消息,所以我认为这方面没有限制。 当传输失败时,SPWF01SA1没有说什么,我只是没有得到服务器的预期回复。 我还试图将我的单个POST请求拆分为一系列AT + S.HTTPREQ命令(一个用于POST头,一个用于32个字节的数据),但我无法使其工作。因此我认为这种分裂是不可能的。 我的问题:这个模块有没有办法使用单个POST请求发送64 kByte的二进制数据块? 传输大量数据的推荐方法是什么? 谢谢。 #HTTP-POST 以上来自于谷歌翻译 以下为原文 Hi, I'm using a SPWF01SA1 module to send data from my application to a central server using POST requests. I need to transfer 64 kByte of binary data (application/octet-stream) using a single POST request as I want the destination server to receive a single transfer command which must be validated and confirmed back for correct reception. I've seen that the command AT+S.HTTPPOST has limitations on maximum length so I cannot use it. Then I've upgraded the firmware to version 3.5 to try command AT+S.HTTPREQ, build my own POST header and be able to send data after the command. In this way I've managed to send up to something less than 12 kByte. During transfer, the RTS signal is raised every 1024 byte so I inserted a pause to let the buffer flush. No matter how long I wait between the HTTPREQ command and the data (should I wait?) or between RTS signals (all of which stay deasserted for a fixed time of less than 3.5 ms and I've raised my pause time up to 1 s): when the data amount is 11460 bytes or more the packet won't reach its destination while with 11440 bytes everything works fine. My current destination for testing is posttestserver.com, where I've found stored messages of several kBytes (even one slightly less than 1 MByte) so I assume that there's not a limitation on that side. When the transmission fails the SPWF01SA1 doesn't say anything, I simply don't get the expected reply from the server. I've also tried to split my single POST request into a sequence of AT+S.HTTPREQ commands (one for the POST header and one for just 32 bytes of data) but I couldn't make it work. Hence I assume that this splitting is not possible. My question: is there a way with this module to send a 64 kByte block of binary data using a single POST request? What is the recommended way to transfer large amounts of data? Thank you. #http-post |
|
相关推荐
5个回答
|
|
Ciao Luca,
我认为你面临着低RAM问题。单个AT命令(GET,POST,REQ或其他)没有64Kb可用。您需要使用较低的缓冲区大小,因此,请使用套接字。 HTTP命令执行单个操作分为3个步骤: - 连接 - 单写 - 断开连接 你可以切换到: - SOCKON - SOCKWRITE#1 - ...... - SOCKWRITE #n - SOCKC 让我知道它是否有效(我希望如此......) BR 杰瑞 以上来自于谷歌翻译 以下为原文 Ciao Luca, I think you are facing a low RAM problem. There are not 64Kb available for a single AT command (GET, POST, REQ, or other). You need to use a lower buffer size, so, use sockets. HTTP commands perform single operation into 3 steps: - connect - single write - disconnect You can switch to: - SOCKON - SOCKWRITE #1 - ... - SOCKWRITE #n - SOCKC Let me know if it works (I expect so...) BR jerry |
|
|
|
Ciao Jerry,
好吧,我看到使用套接字是唯一的方法,就像你说的那样。我刚刚设法转移16 kByte所以这似乎是解决方案。 我只是希望有一种更简单的方法。 谢谢。 卢卡 以上来自于谷歌翻译 以下为原文 Ciao Jerry, ok, I see that using sockets is the only way, as you say. I've just managed to transfer 16 kByte so this seems to be the solution. I just hoped there was an easier way. Thank you. Luca |
|
|
|
Ciao Jerry,
我想请你澄清一下RTS信号。 我已经使用套接字实现了我的数据传输。数据以4 kByte块分割,并与AT + S.SOCKW命令序列一起发送。一切都很好。 我看到的是,在每个4 KB的传输过程中,RTS信号每1024字节升高~3.5 ms。即使我完全忽略它,也可以正确获取所有数据。 UART速度是默认的115200波特。 我想知道我是否可以放心地忽略这个RTS故障。如果忽略它不会造成伤害,我无法理解它的目的。 我的猜测是,一旦UART完成第1024字节接收,内部1 kByte缓冲区就满了,RTS被置位(取消断言),数据从第一个字节开始从其他地方的内部缓冲区(另一个内部缓冲区?)传输。内部传输的速度是这样的,当UART获得第1025个字节(之后约87μs)时,缓冲区的第一个字节已经被释放,因此可以安全地存储传入的新字节。然后最终,当原始的前1024个字节已被传输(之后约3.5毫秒)时,RTS再次被置位。 我对吗?我可以假设这种行为是一致的,所以如果UART速度不是太高,RTS信号可以被忽略吗? 这对我来说非常重要,因为我的MCU是5V供电而RTS信号高电平(2.5 V)太低而没有电平转换。它是一个5V耐压引脚,当上拉时它不使用时会上升到5V,但是当它工作时它会从0V上升到2.5V。糟糕的是它不是一个开路集电极(对于TX引脚也是如此:5V容忍但是推挽,因此需要额外的电路)。如果我可以放心地忽略它,那就更好了。 谢谢。 卢卡 以上来自于谷歌翻译 以下为原文 Ciao Jerry, I'd like to ask you a clarification about the RTS signal. I've implemented the transmission of my data using a socket. The data is split in 4 kByte chunks and sent with a sequence of AT+S.SOCKW commands. Everything is working fine. What I see is that during each 4 KByte transmission the RTS signal is raised every 1024 bytes for ~3.5 ms. Even if I completely ignore it, all data is correctly acquired. The UART speed is the default 115200 baud. I'd like to know if I can safely ignore this RTS glitch. I can't understand its purpose if ignoring it causes no harm. My guess is that as soon as the UART completes the 1024th byte reception the internal 1 kByte buffer is full, RTS is raised (deasserted) and the data is transferred from the internal buffer somewhere else (another internal buffer?) starting from the first byte. The speed of the internal transfer is such that when the UART gets the 1025th byte (~87 µs after), the first bytes of the buffer have already been freed so the incoming new bytes can be safely stored. Then eventually, when the original first 1024 bytes have been transferred (~3.5 ms after), the RTS is asserted again. Am I right? Can I assume this behavior is going to be consistent so if the UART speed is not too high the RTS signal can be ignored? This is an important point for me because my MCU is powered at 5V and the RTS signal high level (2.5 V) is too low to be seen without a level shift. It's a 5V tolerant pin such that with a pull-up it goes up to 5V when it's not in use, but when it's working it goes from 0V to 2.5V. Bad it's not an open collector (and the same is true for the TX pin: 5V tolerant but push-pull so additional circuitry is needed). If I can safely ignore it, it would be better. Thank you. Luca |
|
|
|
Ciao Luca,
你可以放心地忽略RTS,但一定要在下一个SOCKW之前正确处理模块的OK / ERROR。 RTS在data_mode中是必需的,因为您没有数据传输的反馈(OK / ERROR)。 再见 Ĵ 以上来自于谷歌翻译 以下为原文 Ciao Luca, you can safely ignore RTS, but be sure to handle properly module's OK/ERROR before next SOCKW. RTS is really mandatory in data_mode, since you have no feedback (OK/ERROR) on data transfer. Ciao j |
|
|
|
嗨,杰里,
很好,非常感谢你提供这些好消息。 问候。 卢卡 以上来自于谷歌翻译 以下为原文 Hi jerry, fine, thank you very much for this good information. Regards. Luca |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2634 浏览 1 评论
3208 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1783 浏览 1 评论
3609 浏览 6 评论
5987 浏览 21 评论
939浏览 4评论
1315浏览 4评论
在Linux上安装Atollic TRUEStudio的步骤有哪些呢?
582浏览 3评论
使用DMA激活某些外设会以导致外设无法工作的方式生成代码是怎么回事
1302浏览 3评论
1358浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 17:44 , Processed in 1.245655 second(s), Total 85, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号