[Решено] клиент библиотеки Ethernet_stm.Читать () не работай

Шехарсабале
Пт, 01 июня 2018 г., 9:21
Привет,
- У моей среды разработки компьютера: OS-Windows 7 64 BIT, IDE Version-Aduino IDE 1.6.11, библиотечная версия-Ethernet_stm,
Источник библиотеки-https: // github.com/serasidis/ethernet_stm
STM32 Blupill, W5100 Ethernet


Я использую щит W5100 и синюю таблетку STM32...Попытка http получить код функции ..Он подключается к серверу, но не печатает заголовки HTTP и корпус ответа...На самом деле он также не печатает последовательно, что написано в Setup ()...Также попробовал разные ставки бода ....Но не повезло
код: #include #include // Newer Ethernet shields have a MAC address printed on a sticker on the shield byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // if you don't want to use DNS (and reduce your sketch size) // use the numeric IP instead of the name for the server: IPAddress gateway( 192, 168, 10, 3); IPAddress subnet( 255, 255, 255, 0 ); IPAddress dns1( 59, 144, 127, 16); //IPAddress server(192, 168, 10, 191); IPAddress ip(192, 168, 10, 11); char server[] = "https://test-turnstile.gymshim.com"; // Initialize the Ethernet client library // with the IP address and port of the server // that you want to connect to (port 80 is default for HTTP): EthernetClient client; ////////////////////// void setup() { Serial.begin(9600); // init Serial USB while (!Serial); delay(10); Serial.println("Hello from USB Serial !!"); Ethernet.begin(mac, ip, dns1, gateway, subnet); delay(500); Serial.println("Send an e in serial monitor to test"); // what to do to test } void loop() { // check for serial input if (Serial.available() > 0) //if something in serial buffer { byte inChar; // sets inChar as a byte inChar = Serial.read(); //gets byte from buffer if (inChar == 'e') // checks to see byte is an e { sendGET(); } } } void sendGET() { if (client.connect(server, 80)) { //starts client connection, checks for connection Serial.println("connected"); client.print(String("GET ") + "/api/v2/turnstile/user_access?qr_code_number=123&tripod_uniq_id=1234" + " HTTP/1.1\r\n" + "Host:https://test-turnstile.gymshim.com" + "\r\n" + "Connection: close\r\n\r\n"); Serial.println("request sent"); } else { Serial.println("connection failed"); //error message if no client connect Serial.println(); } if (client.available()) { char c = client.read(); Serial.print(c); } client.stop(); Serial.println("client disconnected."); }

Вассилис
Пт, 01 июня 2018 г., 10:14
Пожалуйста, следуйте инструкциям, чтобы выбрать W5100 чип. По умолчанию W5500 выбран.
Выбор контроллера типа Ethernet (W5100, W5200 или W5500)

Для выбора этих чипов дерева редактировать файл: Ethernet_stm \ src \ utility \ w5100.H и комментировать только линию с чипом, которую вы хотите использовать.

По умолчанию выбирается контроллер Ethernet W5500.

//#определить w5100_ethernet_shield // arduino ethield and compatibles ...
//#определить w5200_ethernet_shield // wiz820io, w5200 Ethernet Shield
#define w5500_ethernet_shield // wiz550io, серия Wiznet ioshield

Если вы отредактируете W5100.h Файл, сохраните и повторно выполняет свой эскиз.

Шехарсабале
Пт, 01 июня 2018 г., 10:22
Да, сэр, я сделал это, это уже выбрано W5100 Ethernet Shield ..его компиляция загрузка ОК...Тот же эскиз с arduino nano и w5100 щитом с ehernet
Библиотека работает нормально.....
Получил вывод с Arduino Nano что -то в этом роде: connecting... connected HTTP/1.1 200 OK Cache-Control: no-cache Pragma: no-cache Content-Type: application/json; charset=utf-8 Expires: -1 Server: Microsoft-IIS/7.5 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Mon, 28 May 2018 11:13:31 GMT Connection: close Content-Length: 12 "123-1234-1" disconnecting

Вассилис
Пт, 01 июня 2018 г., 11:54
Ваш эскиз кажется неверным. Вы пытаетесь позвонить на веб -сайт HTTPS (Secure), позвонив в порт 80. HTTPS использует порт 443. Общение также зашифровано.

Покажите мне эскиз, который вы использовали с Arduino Library + Arduino Nano + W5100, и серийный вывод после подключения к серверу.

Шехарсабале
Пт, 01 июня 2018 12:03
Уважаемый господин,
На самом деле теперь я попробовал код из примеров библиотеки Ethernet_stm WebClient: /* Web client This sketch connects to a website (http://www.google.com) using an Arduino Wiznet Ethernet shield. Circuit: * Ethernet shield attached to pins 10, 11, 12, 13 created 18 Dec 2009 by David A. Mellis modified 9 Apr 2012 by Tom Igoe, based on work by Adrian McEwen modified 12 Aug 2013 by Soohwan Kim Modified 18 Aug 2015 by Vassilis Serasidis ========================================================= Ported to STM32F103 on 18 Aug 2015 by Vassilis Serasidis <---- Pinout ----> W5100 <--> STM32F103 SS <--> PA4 <--> BOARD_SPI1_NSS_PIN SCK <--> PA5 <--> BOARD_SPI1_SCK_PIN MISO <--> PA6 <--> BOARD_SPI1_MISO_PIN MOSI <--> PA7 <--> BOARD_SPI1_MOSI_PIN ========================================================= */ #include #include // Enter a MAC address for your controller below. // Newer Ethernet shields have a MAC address printed on a sticker on the shield #if defined(WIZ550io_WITH_MACADDRESS) // Use assigned MAC address of WIZ550io ; #else byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; #endif // if you don't want to use DNS (and reduce your sketch size) // use the numeric IP instead of the name for the server: //IPAddress server(74,125,232,128); // numeric IP for Google (no DNS) char server[] = "www.serasidis.gr"; // name address for Google (using DNS) // Set the static IP address to use if the DHCP fails to assign IPAddress ip(192,168,10,11); // Initialize the Ethernet client library // with the IP address and port of the server // that you want to connect to (port 80 is default for HTTP): EthernetClient client; void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only } // start the Ethernet connection: #if defined(WIZ550io_WITH_MACADDRESS) if (Ethernet.begin() == 0) { #else if (Ethernet.begin(mac) == 0) { #endif Serial.println("Failed to configure Ethernet using DHCP"); // no point in carrying on, so do nothing forevermore: // try to congifure using IP address instead of DHCP: #if defined(WIZ550io_WITH_MACADDRESS) Ethernet.begin(ip); #else Ethernet.begin(mac, ip); #endif } // give the Ethernet shield a second to initialize: delay(1000); Serial.println("connecting..."); // if you get a connection, report back via serial: if (client.connect(server, 80)) { Serial.println("connected"); // Make a HTTP request: client.println("GET /util/time.php HTTP/1.1"); client.println("Host: www.serasidis.gr"); client.println("Connection: close"); client.println(); } else { // if you didn't get a connection to the server: Serial.println("connection failed"); } } void loop() { // if there are incoming bytes available // from the server, read them and print them: if (client.available()) { char c = client.read(); Serial.println(c); } // if the server's disconnected, stop the client: if (!client.connected()) { Serial.println(); Serial.println("disconnecting."); client.stop(); // do nothing forevermore: while(true); } }

Стивестронг
Пт, 01 июня 2018 г. 13:00
Потому что у клиента нет доступных данных.

Проверьте свое соединение между W5100 и Bluepill.

Вассилис
Пт, 01 июня 2018 13:05
Это определенно проблема с проволочным соединением.
Вы положили резистор между сбросом и 3V3 на модуле W5100 ?
Изображение

Вассилис
SAT 02 июня 2018 г., 4:43
Шехарсабале, Проблема решена ?

Шехарсабале
SAT 02 июня 2018 г., 5:08 утра
У меня есть мини -щит Ethernet

Я подключен так:

USB Serial Blue Pill Ethernet щит
+5 В ------ +5V внешний 5 В

GND ------ GND ------ Внешнее снабжение GND
TX ------ A10
RX ------ A9
Синяя таблетка Ethernet Shield

A4 ------ NSS
A5 ------ SCK
A6 ------ Мисо
A7 ------ Моси

вставлено 4.7k между +5 В и сброшенным щитом Ethernet

Также попробовал общую силу +5 В от USB -серийного до синей таблетки и щита Ethernet

Все еще дает такой же результат :рулон:

Стивестронг
SAT 02 июня 2018 г., 7:13
Это действительно w5100, а не W5500? Я не вижу это ясно на картинке.

Вассилис
SAT 02 июня 2018 г., 7:39 утра
[Стивестронг - SAT 02, 2018, 7:13] - Это действительно w5100, а не W5500? Я не вижу это ясно на картинке.
Я думал то же самое, но у W5500 меньше булавок, чем W5100.
Изображение

Вассилис
SAT 02 июня 2018 г. 8:22 утра
Попробуйте этот эскиз и покажите нам вывод
Если проблема остается, включите эту строку //delay(3000); //Enable this line if the problem remains

Джарек.П
Чт, 07 июня 2018 г., 9:08 утра
Привет,

Я хотел бы присоединиться к этой теме, потому что у меня также проблема с W5500. Модуль был в порядке, протестированный с Arduino, но я не могу настроить его с STM32. Когда я пробую этот пример WebClient, мой вывод выглядит следующим образом:
Opening port Port open connecting... A: 3393 connected B: 8451 disconnecting.

Стивестронг
Чт, 07 июня 2018 г., 11:22 утра
В качестве альтернативы только для W5500, вы можете использовать эту LIB: https: // github.com/stevstrong/ethernet_stm32
Если у вас есть проблемы с построением, я предлагаю использовать это ядро ​​(раздвоенное от официального ядра Роджера): https: // github.com/stevstrong/arduino_stm32
Если у вас есть дальнейшие проблемы с этим, откройте новую ветку.

Джарек.П
Пн 11 июня 2018 г. 10:18 утра
Привет,

Моя проблема решена, причины не так ясны, но они были связаны с беспорядком в моих библиотеках (Arduino, ESP и теперь библиотеки STM в одной общей папке), после того, как очистка все начали работать. Теперь у меня есть другие вопросы относительно того, как обнаружить связь L1 Ethernet, но, возможно, в новой теме.
Спасибо за помощь!

Вассилис
Вт 12 июня 2018 г., 6:26
[Джарек.П - Пн 11 июня 2018 г. 10:18] - Привет,

Моя проблема решена, причины не так ясны, но они были связаны с беспорядком в моих библиотеках (Arduino, ESP и теперь библиотеки STM в одной общей папке), после того, как очистка все начали работать. Теперь у меня есть другие вопросы относительно того, как обнаружить связь L1 Ethernet, но, возможно, в новой теме.
Спасибо за помощь!
Спасибо, что сообщили нам

ПИН -функции на доске.CPP