ESP8266 Developer Zone The Official ESP8266 Forum 2022-07-07T12:52:10+08:00 https://bbs.espressif.com:443/feed.php?f=31 2022-07-07T12:52:10+08:00 2022-07-07T12:52:10+08:00 https://bbs.espressif.com:443/viewtopic.php?t=75571&p=101926#p101926 <![CDATA[Sample Codes • Control Mecanum wheels with ESP32]]>
I am working on a robotic project, where I need to control the 4 wheeler robot with mobile. I am using mecanum wheels for the robots movement, as its the requirement. we want exact movements. Moreover, I am using ESP32 for WiFi purpose.

The idea is to control the movements of robot using mobile app. It has to cross a maze with time limit. So, if anyone could help or guide me in right direction.

Thanks.

Statistics: Posted by andrea05256 — Thu Jul 07, 2022 12:52 pm


]]>
2022-04-23T04:11:20+08:00 2022-04-23T04:11:20+08:00 https://bbs.espressif.com:443/viewtopic.php?t=75329&p=100954#p100954 <![CDATA[Sample Codes • [ESP8266] flashing the spiffs and using it as webserver]]>
As I struggled to use the spiffs on the esp8266, I decided to rename my work in progress repo to make it into a tutorial on "how to flash and use spiffs as a webserver".

I was trying to convert the arduino tutorial "A Beginner's Guide to the ESP8266" into the ESP8266_RTOS_SDK. Even if the conversion is not complete, the main part being the problem with the spiffs documentation of the esp8266, I hope it will be helpfull for some of you out there !

As I see, I think this solution is quite different than the Bernard's approach.

Here's my WIP spiffs webserver's repository. I hope I didn't make too much errors, easy to use for everyone (not just me on my computer...) and it will be a good help for beginners and others.

At the moment what it does :
  • Integrated into the project's Cmake file for auto compiling and flashing.
  • Create an image of the files to be flash into the spiffs.
  • Flash the spiffs binaries with the code each time (need to comment the line in the Cmake file. Would like to add an option to be able to "flash" or "flash all").
  • The esp can browse all the files inside the spiffs.
  • The esp can fetch all the files asked and send it to the client (needs to modify the sdk).
  • Basic threadless websocket client gestion (code from IBM)(the esp was rebooting with more than 3 websockets threads, no idea why, ressources ?)

TODO list :
  • Adding the websocket protocol.
  • Adding led control (as seen in the exemples).
  • Adds more (refactor) comments in order to match Doxygen's style.

All criticism is welcomed and higly appreciated, my work is far from perfect and bugs free.

Regards, Extro.

Statistics: Posted by extro — Sat Apr 23, 2022 4:11 am


]]>
2022-02-15T16:51:22+08:00 2022-02-15T16:51:22+08:00 https://bbs.espressif.com:443/viewtopic.php?t=440&p=100665#p100665 <![CDATA[Sample Codes • Re: ESP8266 Sends UDP data]]> Statistics: Posted by sonmezroy — Tue Feb 15, 2022 4:51 pm


]]>
2021-07-26T17:50:14+08:00 2021-07-26T17:50:14+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1716&p=100085#p100085 <![CDATA[Sample Codes • Re: ESP8266 - GOOGLE CLOUD MESSAGING WITHOUT EXTERNAL SERVER]]>

Code:

https://gcm-http.googleapis.com/gcm/send
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA

{ "data": {
    "score": "5x1",
    "time": "15:10"
  },
  "to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1..."
}


First I've tryed to use the ajax method:

Code:

var textNotification={
    "notification": {
        "title": "Portugal vs. Denmark",
        "text": "5 to 1"
    }
};
    $.ajax(
    {
        url : "https://gcm-http.googleapis.com/gcm/send",
        type : "POST",
        headers :
        {
            'Authorization' : 'AIzaSyZ-1u...',
            'Content-type': 'application/json'
        },
        data : textNotification
    }
    ).done(function (data)
    {
        console.log(data);
    }
    );


As aspected, due to the fact I'm trying to send an HTTPS request from my PC, it is blocked. Is there another way to follow?

source : https://wasaelgroup.com

Statistics: Posted by RalphKeil — Mon Jul 26, 2021 5:50 pm


]]>
2020-03-29T16:55:23+08:00 2020-03-29T16:55:23+08:00 https://bbs.espressif.com:443/viewtopic.php?t=55688&p=75014#p75014 <![CDATA[Sample Codes • Coremark result for ESP8266]]>
In case some of you may be interested, I run the Coremark benchmark on ESP8266 (and ESP32). I will try to add more cores (comparable to ESP8266 or ESP32) in the future.

You can find the source code here:
https://github.com/ochrin/coremark

Results are:

Statistics: Posted by Bernard — Sun Mar 29, 2020 4:55 pm


]]> 2020-03-14T08:48:36+08:00 2020-03-14T08:48:36+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1346&p=74259#p74259 <![CDATA[Sample Codes • ESP8266 SPI as slave]]> Statistics: Posted by KeithSkync — Sat Mar 14, 2020 8:48 am


]]>
2019-10-16T10:49:38+08:00 2019-10-16T10:49:38+08:00 https://bbs.espressif.com:443/viewtopic.php?t=763&p=66787#p66787 <![CDATA[Sample Codes • ESP8266 as TCP server]]>
while1
   
    TRISCbits.TRISC5 = 1 ;         / set RC5 for input     /
    TRISBbits.TRISB4  = 0 ;         / set RB4 for output     /

   if TCPIsConnectedtcpsocket

            if PORTCbits.RC5 == 1
            / check the input on PORTB  /
i = 0; / Initialize i/
pulse_en = 1; / set state variable/
if PORTCbits.RC5 == 0 & pulse_en == 1
            /look for an on-to-off transition/
                LATBbits.LATB4 = 1 ;  / light on if pulse         /
DelayMs1000;
LATBbits.LATB4 = 0 ;  / turn pulse off after timeout /
             
pulse_en = 0;
             
       
   
else

Socket_ok = 0;

        if TickGetDiffTickGet, t >= TICK_SECOND/pulse_rec
       
            t = TickGet;
            LATB6 = 1;
       

        //Perform routine tasks
        MACTask;

        /
          This task performs normal stack task including checking
          for incoming packet, type of packet and calling
          appropriate stack entity to process it.
         /
        StackTask;

if Socket_ok

LATBbits.LATB4 = 1 ; 
DelayMs1000;
LATBbits.LATB4 = 0 ; 

ifTCPIsGetReadytcpsocket

TCPGettcpsocket, &pulse;
DelayMs50;
pulse_rec = 8;
TCPDiscardtcpsocket;
if TCPIsPutReadytcpsocket

TCPPuttcpsocket, pulse;
DelayMs50;
TCPFlushtcpsocket;
DelayMs50;
TCPDiscardtcpsocket; //Release the buffer




else

tcpsocket = TCPListenport;
if tcpsocket = INVALID_SOCKET

Socket_ok = TRUE;





This code does connect right now over port 200. The value assigned to the port in the variable declaration. I can see that on Ethereal. However, that's all it does. It does not echo anything back. The evidence is that the pulse rate on the built-in LED does not change. I have the pulse starting out at 1 every second. And I am trying to change it to once every 1/8th of a send once the TCPGet occurs. And the pulse rate is not changing. I am also trying to turn on another LED that I added for one second once the socket is connected. That's not hapenning either. I am starting to suspect that maybe another task is getting attached. The HTTP task attaches on port 80 though, not 200. Can you help me with this?

Thanks,

Rami Salah

Statistics: Posted by Guest — Wed Oct 16, 2019 10:49 am


]]>
2019-09-25T11:30:33+08:00 2019-09-25T11:30:33+08:00 https://bbs.espressif.com:443/viewtopic.php?t=229&p=66098#p66098 <![CDATA[Sample Codes • ESP8266 Station mode Scan for routers]]> Statistics: Posted by Tofd8lger — Wed Sep 25, 2019 11:30 am


]]>
2019-07-13T10:18:26+08:00 2019-07-13T10:18:26+08:00 https://bbs.espressif.com:443/viewtopic.php?t=763&p=49179#p49179 <![CDATA[Sample Codes • Re: ESP8266 as TCP server]]> Statistics: Posted by Guest — Sat Jul 13, 2019 10:18 am


]]>
2019-04-24T18:13:52+08:00 2019-04-24T18:13:52+08:00 https://bbs.espressif.com:443/viewtopic.php?t=11458&p=39929#p39929 <![CDATA[Sample Codes • Re: SPIFFS: From image creation to read & write through flashing]]> And even more it is better to update value in the file than do a direct copy of this file from RTOS_SDK.
You should also keep SPIFFS_TEST_VISUALISATION to 1 in order to be able to compile.
I have updated my first post.

Anyway, I don't think this fix will solve your problem.

Statistics: Posted by Bernard — Wed Apr 24, 2019 6:13 pm


]]>
2019-03-18T00:50:23+08:00 2019-03-18T00:50:23+08:00 https://bbs.espressif.com:443/viewtopic.php?t=11458&p=38761#p38761 <![CDATA[Sample Codes • Re: SPIFFS: From image creation to read & write through flashing]]> So I can't tell you what is wrong.
If I have time, I will give it a try and let you know my result.

Statistics: Posted by Bernard — Mon Mar 18, 2019 12:50 am


]]>
2019-03-15T19:54:35+08:00 2019-03-15T19:54:35+08:00 https://bbs.espressif.com:443/viewtopic.php?t=11458&p=38725#p38725 <![CDATA[Sample Codes • Re: SPIFFS: From image creation to read & write through flashing]]>
i try build using RTOSSDK IDFstyle , and using esp826612E 4MB Flash (1MB SPIFFS)

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 7196, room 16
0x40100000: _stext at ??:?

tail 12
chksum 0x51
ho 0 tail 12 room 4
load 0x3ffe8408, len 24, room 12
tail 12
chksum 0xd8
ho 0 tail 12 room 4
load 0x3ffe8420, len 3548, room 12
tail 0
chksum 0xa2
I (51) boot: ESP-IDF v3.2-dev-137-g93e3a3f5 2nd stage bootloader
I (51) boot: compile time 08:31:07
I (51) qio_mode: Enabling default flash chip QIO
I (59) boot: SPI Speed : 40MHz
I (66) boot: SPI Mode : QIO
I (72) boot: SPI Flash Size : 2MB
I (78) boot: Partition Table:
I (84) boot: ## Label Usage Type ST Offset Length
I (95) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (106) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (118) boot: 2 factory factory app 00 00 00010000 000f0000
I (130) boot: End of partition table
I (136) esp_image: segment 0: paddr=0x00010010 vaddr=0x40210010 size=0x35ae0 (219872) map
I (223) esp_image: segment 1: paddr=0x00045af8 vaddr=0x3ffe8000 size=0x00548 ( 1352) load
I (224) esp_image: segment 2: paddr=0x00046048 vaddr=0x3ffe8548 size=0x0011c ( 284) load
I (235) esp_image: segment 3: paddr=0x0004616c vaddr=0x40100000 size=0x06004 ( 24580) load
0x40100000: _stext at ??:?

I (256) boot: Loaded app from partition at offset 0x10000
I (277) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (287) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (487) reset_reason: RTC reset 2 wakeup 0 store 0, reason is 2
open file error
write file error
ERR: Can't open file! 0
ERR: Can't open file! 0


and this is my code



/*
* user_spiffs.c
*
*/
#include "esp_spiffs.h"
#include "spiffs.h"

#include <fcntl.h>

#define FS1_FLASH_SIZE (1000*1024) // Size of SPIFFS image 0xfa000
#define FS1_FLASH_ADDR (3*1024*1024) // Start of SPIFFS image in FLASH memory space 0x300000
#define SECTOR_SIZE (8*1024)
#define LOG_BLOCK (SECTOR_SIZE) // Size of a logical block
#define LOG_PAGE (256) // Size of a logical page
#define FD_BUF_SIZE 32*4
#define CACHE_BUF_SIZE (LOG_PAGE + 32)*8

void spiffs_fs1_init(void)
{
s32_t ret;
struct esp_spiffs_config config;

config.phys_size = FS1_FLASH_SIZE;
config.phys_addr = FS1_FLASH_ADDR;
config.phys_erase_block = SECTOR_SIZE;
config.log_block_size = LOG_BLOCK;
config.log_page_size = LOG_PAGE;
config.fd_buf_size = FD_BUF_SIZE * 2;
config.cache_buf_size = CACHE_BUF_SIZE;

ret = esp_spiffs_init(&config);
if (ret)
os_printf("ERR: Can't init spiffs image!\n");
}

void spiffs_main()
{
char out[20] = { 0 };
int pfd;
//int res;

// Mount SPIFFS image
spiffs_fs1_init();

// Create a new file
char *buf = "hello world";

pfd = open("myfile", O_TRUNC | O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
if (pfd <= 3) {
printf("open file error\n");
}

// Write to new file
int write_byte = write(pfd, buf, strlen(buf));
if (write_byte <= 0) {
printf("write file error\n");
}
close(pfd);

// Read previous created file
pfd = open("myfile", O_RDWR);
if (pfd < 3)
os_printf("ERR: Can't open file! %d\n", pfd);
else {
if (read(pfd, out, 20) < 0)
os_printf("ERR: Can't read file!\n");
close(pfd);
printf("--> %s <--\n", out);
}

// Read file from generated image with mkspiffs tool
pfd = open("/readme.txt", O_RDWR); // !! Don't forget to add the / before the name of the file
if (pfd < 3)
os_printf("ERR: Can't open file! %d\n", pfd);
else {
if (read(pfd, out, 20) < 0)
os_printf("ERR: Can't read file!\n");
close(pfd);
printf("--> %s <--\n", out);
}
}

void app_main(){
spiffs_main();
}

Statistics: Posted by Guest — Fri Mar 15, 2019 7:54 pm


]]>
2019-01-13T17:51:18+08:00 2019-01-13T17:51:18+08:00 https://bbs.espressif.com:443/viewtopic.php?t=320&p=36720#p36720 <![CDATA[Sample Codes • ESP8266 sends TCP packets continuously]]> Statistics: Posted by Guest — Sun Jan 13, 2019 5:51 pm


]]>
2019-01-06T07:40:21+08:00 2019-01-06T07:40:21+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1346&p=36603#p36603 <![CDATA[Sample Codes • ESP8266 SPI as slave]]>
I’ve been doing some work with a new product using a few pics and I need usb support adding so I’ve added another pic and have a selection of lines between them

unfortunately I’m stuck with general purpose i/o lines on the master pic but the slave usb pic has hardware spi lines available

I’ve been trying to use the hardware spi in slave mode without a great deal of consistent success I can transmit to the slave just fine but I cant seem to recover any real data from it,

Has anyone tried this or can anyone suggest another way of sending packets of byte between 2 pics,

Bear in mind that both pics are using interrupts and the usarts are not available on the master.

Any suggestions?


Master = 4550 but could be a different one
Slave is 2550

Master name slave
A.0 nspisel B.4
A.3 spiclk B.1
C.6 miso C.7
B.0 mosi B.0
B.1 slave busy B.3


thanks in advance

Richard

Statistics: Posted by Guest — Sun Jan 06, 2019 7:40 am


]]>
2018-10-14T05:51:01+08:00 2018-10-14T05:51:01+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1346&p=33600#p33600 <![CDATA[Sample Codes • ESP8266 SPI as slave]]> Statistics: Posted by Guest — Sun Oct 14, 2018 5:51 am


]]>
2018-09-20T00:07:40+08:00 2018-09-20T00:07:40+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1378&p=23798#p23798 <![CDATA[Sample Codes • Re: [ESP8266] PWM Demo_For_ESP8266_NONOS_SDK]]> Statistics: Posted by simonliu — Thu Sep 20, 2018 12:07 am


]]>
2019-04-24T18:17:29+08:00 2018-07-11T17:22:39+08:00 https://bbs.espressif.com:443/viewtopic.php?t=11458&p=22052#p22052 <![CDATA[Sample Codes • SPIFFS: From image creation to read & write through flashing]]>
Compile mkspiffs (tool used to generate a SPIFFS image)
Use mkspiffs tool: https://github.com/igrr/mkspiffs
git clone --recurse-submodules git@github.com:igrr/mkspiffs.git to clone (with sub module)

Note: the sub module here is spiffs source. Unfortunately, these spiffs sources do not  match the ones from RTOS SDK. That's why you have to copy the following files:
/path/to/ESP8266_RTOS_SDK/third_party/spiffs/*.c (but not esp_spiffs.c) to /path/to/mkspiffs/spiffs/src/
/path/to/ESP8266_RTOS_SDK/include/spiffs/spiffs.h to /path/to/mkspiffs/spiffs/src/
/path/to/ESP8266_RTOS_SDK/include/spiffs/spiffs_nucleus.h to /path/to/mkspiffs/spiffs/src/

And you have to update the file /path/to/mkspiffs/include/spiffs_config.h with the values from /path/to/ESP8266_RTOS_SDK/include/spiffs/spiffs_config.h
You should keep anyway the value of SPIFFS_TEST_VISUALISATION to 1 in order to be able to compile.

Then compile with make dist
Normally you should not get any errors, but if you get some, you will have to fix them.

Create SPIFFS image
Now put all you files you want in your image in a folder called data/
Note: There should be no subfolder as SPIFFS only works with a flat hierarchy. Max lenght for a file name is 31 characters. When you want to open a file from esp8266, you should add a / before file name (see code)

Generate the image by typing:
/path/to/mkspiffs/mkspiffs –p 256 –b 8192 –s 0xfa000 –c /path/to/data/ spiffs-image.bin
Where:
-p 256 indicates the size of the page (should match what you will put in esp8266 code)
-b 8192 indicates the size of the block (should match what you will put in esp8266 code)
-s 0xfa000 ndicates the size of the image (should match what you will put in esp8266 code). Here our image will go from 0x300000 to 0x3fa000 as from 0x3fc000 we have other images (system param)

Flash SPIFFS image
esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash 0x300000 spiffs-image.bin
Image is flashed at adress 0x300000

Read SPIFFS image from ESP8266
Here is a code:

Code:

/*
* user_spiffs.c
*
*/
 
#include "esp_common.h"
#include "spiffs.h"

#include <fcntl.h>
 
#define FS1_FLASH_SIZE      (1000*1024)                // Size of SPIFFS image 0xfa000
#define FS1_FLASH_ADDR      (3*1024*1024)            // Start of SPIFFS image in FLASH memory space 0x300000
#define SECTOR_SIZE         (8*1024)
#define LOG_BLOCK           (SECTOR_SIZE)            // Size of a logical block
#define LOG_PAGE            (256)                    // Size of a logical page
#define FD_BUF_SIZE         32*4
#define CACHE_BUF_SIZE      (LOG_PAGE + 32)*8
 
void spiffs_fs1_init(void)
{
    s32_t ret;
    struct esp_spiffs_config config;
 
    config.phys_size = FS1_FLASH_SIZE;
    config.phys_addr = FS1_FLASH_ADDR;
    config.phys_erase_block = SECTOR_SIZE;
    config.log_block_size = LOG_BLOCK;
    config.log_page_size = LOG_PAGE;
    config.fd_buf_size = FD_BUF_SIZE * 2;
    config.cache_buf_size = CACHE_BUF_SIZE;
 
    ret = esp_spiffs_init(&config);
    if (ret)
        os_printf("ERR: Can't init spiffs image!\n");
}

void spiffs_main()
{
    char out[20] = { 0 };
    int pfd;
    int res;

    // Mount SPIFFS image
    spiffs_fs1_init();
 
    // Create a new file
    char *buf = "hello world";

    pfd = open("myfile", O_TRUNC | O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
    if (pfd <= 3) {
        printf("open file error\n");
    }
     
    // Write to new file
    int write_byte = write(pfd, buf, strlen(buf));
    if (write_byte <= 0) {
        printf("write file error\n");
    }
    close(pfd);
 
    // Read previous created file
    pfd = open("myfile", O_RDWR);
    if (pfd < 3)
        os_printf("ERR: Can't open file! %d\n", pfd);
    else {
        if (read(pfd, out, 20) < 0)
            os_printf("ERR: Can't read file!\n");
        close(pfd);
        printf("--> %s <--\n", out);
    }
 
    // Read file from generated image with mkspiffs tool
    pfd = open("/readme.txt", O_RDWR);            // !! Don't forget to add the / before the name of the file
    if (pfd < 3)
        os_printf("ERR: Can't open file! %d\n", pfd);
    else {
        if (read(pfd, out, 20) < 0)
            os_printf("ERR: Can't read file!\n");
        close(pfd);
        printf("--> %s <--\n", out);
    }
}

Note on page, block, address and size parameters
These parameters depend heavily on the memory you are using.
In my case I am using a 4MB flash (Winbond W25Q32FV).
Page size and block size (256 and 8192) are fine for this memory but other values may work also.
For a 4MB flash, address range is from 0x000000 to 0x400000. I decided to put my SPIFFS image at address 0x300000, but you can put it somewhere else if you prefer (0x100000, 0x200000).
I decided to used a size of 1MB (0x100000) for SPIFFS image but as I am flashing sytem parameter (esp_init_data_default.bin) and blank.bin at resp. 0x3fc000 and 0x3fe000 I need to reduce the size to 0xfa000 (size has to be a multiple of block size)


Hope it will be helpful for people.

Statistics: Posted by Bernard — Wed Jul 11, 2018 5:22 pm


]]>
2018-06-15T09:35:04+08:00 2018-06-15T09:35:04+08:00 https://bbs.espressif.com:443/viewtopic.php?t=440&p=20736#p20736 <![CDATA[Sample Codes • Re: ESP8266 Sends UDP data]]> Statistics: Posted by Her Mary — Fri Jun 15, 2018 9:35 am


]]>
2018-06-13T17:09:24+08:00 2018-06-13T17:09:24+08:00 https://bbs.espressif.com:443/viewtopic.php?t=440&p=20715#p20715 <![CDATA[Sample Codes • Re: ESP8266 Sends UDP data]]> Statistics: Posted by coright — Wed Jun 13, 2018 5:09 pm


]]>
2018-05-24T06:28:07+08:00 2018-05-24T06:28:07+08:00 https://bbs.espressif.com:443/viewtopic.php?t=763&p=20548#p20548 <![CDATA[Sample Codes • ESP8266 as TCP server]]> I have noticed some examples found in the help web page for wlan esp8266. One is the TCP server that a PC can connect the the esp8266 access point and switch on off LEDs.
The other is the TCP client that the esp8266 connects to home router and accesses matrixs web page.

Is there an example of those 2 combined?
It would be good to connect the esp8266 to home router and switch LEDs on off through the internet by enabling port forward on home router.

Thank you
Best Regards
Andreas Achilleos

Statistics: Posted by andreysnug — Thu May 24, 2018 6:28 am


]]>
2018-01-15T15:14:35+08:00 2018-01-15T15:14:35+08:00 https://bbs.espressif.com:443/viewtopic.php?t=440&p=19072#p19072 <![CDATA[Sample Codes • Re: ESP8266 Sends UDP data]]> Statistics: Posted by Her Mary — Mon Jan 15, 2018 3:14 pm


]]>
2018-01-11T20:12:11+08:00 2018-01-11T20:12:11+08:00 https://bbs.espressif.com:443/viewtopic.php?t=440&p=19026#p19026 <![CDATA[Sample Codes • Re: ESP8266 Sends UDP data]]>
I'm trying the similar thing in my network but using station instead of AP. And it doesn't work. I also tried calculate broadcast address accordding IP and mask it doesn't work as well. But send to particular IP works fine.

Any ideas of this behaivor?

I'm using non-os SDK 2.1.x.

Regards,
Alexey.

Statistics: Posted by semlanik — Thu Jan 11, 2018 8:12 pm


]]>
2017-11-30T17:33:14+08:00 2017-11-30T17:33:14+08:00 https://bbs.espressif.com:443/viewtopic.php?t=4048&p=18480#p18480 <![CDATA[Sample Codes • Re: Passive Scan on ESP8266(AP Beacon)]]>
JamelBF wrote:
Hello guys. I'm new here.
Where can I see the information with the basics of the work?
Maybe something for beginners? Very interesting. :)


I do not know dude. :?
I'm looking for myself. I need a couple of questions to ask the key.
I can not find threads in the forum

Statistics: Posted by TommyDI — Thu Nov 30, 2017 5:33 pm


]]>
2017-11-17T19:39:34+08:00 2017-11-17T19:39:34+08:00 https://bbs.espressif.com:443/viewtopic.php?t=4048&p=18206#p18206 <![CDATA[Sample Codes • Re: Passive Scan on ESP8266(AP Beacon)]]> Where can I see the information with the basics of the work?
Maybe something for beginners? Very interesting. :)

Statistics: Posted by JamelBF — Fri Nov 17, 2017 7:39 pm


]]>
2017-10-15T23:44:18+08:00 2017-10-15T23:44:18+08:00 https://bbs.espressif.com:443/viewtopic.php?t=389&p=16448#p16448 <![CDATA[Sample Codes • ESP8266 as TCP SSL client]]> Statistics: Posted by Bentjudges — Sun Oct 15, 2017 11:44 pm


]]>
2017-09-30T18:48:08+08:00 2017-09-30T18:48:08+08:00 https://bbs.espressif.com:443/viewtopic.php?t=320&p=16123#p16123 <![CDATA[Sample Codes • Re: ESP8266 sends TCP packets continuously]]> 如果网络堵塞,等底层缓存等待发送的 buffer 满了,还是会提示发送失败。

Statistics: Posted by Her Mary — Sat Sep 30, 2017 6:48 pm


]]>
2017-08-23T17:15:42+08:00 2017-08-23T17:15:42+08:00 https://bbs.espressif.com:443/viewtopic.php?t=320&p=15293#p15293 <![CDATA[Sample Codes • Re: ESP8266 sends TCP packets continuously]]> Statistics: Posted by Tiffany — Wed Aug 23, 2017 5:15 pm


]]>
2017-08-23T16:38:27+08:00 2017-08-23T16:38:27+08:00 https://bbs.espressif.com:443/viewtopic.php?t=320&p=15291#p15291 <![CDATA[Sample Codes • Re: ESP8266 sends TCP packets continuously]]> Statistics: Posted by Tiffany — Wed Aug 23, 2017 4:38 pm


]]>
2017-06-21T08:05:04+08:00 2017-06-21T08:05:04+08:00 https://bbs.espressif.com:443/viewtopic.php?t=763&p=14134#p14134 <![CDATA[Sample Codes • ESP8266 as TCP server]]> I am Dushyant here
i have made Vb code for Modbus Tcp/Ip. Which works as Server/Slave as well as Client/Master.
Now my software can connect with only one server at one time
so is it possible to be connected for continusly with more then one server?

Statistics: Posted by Dashaduamp — Wed Jun 21, 2017 8:05 am


]]>
2017-06-20T16:10:17+08:00 2017-06-20T16:10:17+08:00 https://bbs.espressif.com:443/viewtopic.php?t=389&p=14125#p14125 <![CDATA[Sample Codes • ESP8266 as TCP SSL client]]> I am Dushyant here
i have made Vb code for Modbus Tcp/Ip. Which works as Server/Slave as well as Client/Master.
Now my software can connect with only one server at one time
so is it possible to be connected for continusly with more then one server?

Statistics: Posted by Dashaduamp — Tue Jun 20, 2017 4:10 pm


]]>
2017-06-20T15:07:37+08:00 2017-06-20T15:07:37+08:00 https://bbs.espressif.com:443/viewtopic.php?t=4048&p=14124#p14124 <![CDATA[Sample Codes • Re: Passive Scan on ESP8266(AP Beacon)]]>
请问是否够在
wifi_set_opmode(STATION_MODE); // Promiscuous works only with station mode
wifi_set_channel(channel);
wifi_promiscuous_set_mac(dstMac);
wifi_promiscuous_enable(disable);
wifi_set_promiscuous_rx_cb(promisc_cb); // Set up promiscuous callback
wifi_promiscuous_enable(enable);

之后,在
void promisc_cb(uint8_t *buf, uint16_t len)
{}
里面获取整个Sniffer到 的数据包,我发送的包长度是1500,但每次在回调函数里面获取的包长是60,128,为什么?

Statistics: Posted by hanehalthy — Tue Jun 20, 2017 3:07 pm


]]>
2017-05-22T16:09:28+08:00 2017-05-22T16:09:28+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1716&p=13327#p13327 <![CDATA[Sample Codes • ESP8266 GOOGLE CLOUD MESSAGING WITHOUT EXTERNAL SERVER]]> Statistics: Posted by JamesRit — Mon May 22, 2017 4:09 pm


]]>
2017-05-03T12:58:39+08:00 2017-05-03T12:58:39+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1346&p=12747#p12747 <![CDATA[Sample Codes • ESP8266 SPI as slave]]> this is my code but its not succes ...

MASTER:
void initSPI_Master
DDRB = 1<<21<<31<<5; // SCK, MOSI dan SS menjadi output
DDRB &= 1<<4; // MISO menjadi input
SPCR = 1<<MSTR; // SPI sebagai master
SPCR = 1<<SPR01<<SPR1; // Pembagi clock = 128
SPCR = 1<<SPE; // Aktifkan SPI

void setup
initSPI_Master;
Serial.begin9600;
pinMode2, INPUT;pinMode3, INPUT; pinMode4, INPUT;
digitalWrite2,HIGH;digitalWrite3, HIGH; digitalWrite4, HIGH;

void loop
//char adc = StringanalogRead0, DEC;
int adc=analogReadA0;
ifdigitalRead2==LOW
kirimData5;
else ifdigitalRead3==LOW
kirimData10;
else ifdigitalRead4==LOW
kirimDataadc;
Serial.printadc;


void kirimDatachar data
SPDR = data; // Kirim data
whileSPSR & 1<<SPIF; // Tunggu sampai pengiriman
delay500;



SLAVE:

unsigned char data;
void initSPI_Slave
DDRB &= 1<<21<<31<<5; // SCK, MOSI dan SS menjadi input
DDRB = 1<<4; // MISO menjadi output
SPCR &= 1<<MSTR; // SPI sebagai slave
SPCR = 1<<SPR01<<SPR1; // Pembagi clock = 128
SPCR = 1<<SPE; // Aktifkan SPI

void setup
initSPI_Slave;
Serial.begin9600;

void loop
whileSPSR & 1<<SPIF; // Tunggu data masuk
data = SPDR;

// Menyimpan isi register SPDR ke variabel data
Serial.println"Data Receive ==> ";
Serial.printlndata,HEX;
delay1000;

<a href=http://sale-discounts.com/>купоны акции</a>

Statistics: Posted by RiliyVax — Wed May 03, 2017 12:58 pm


]]>
2017-04-26T13:26:58+08:00 2017-04-26T13:26:58+08:00 https://bbs.espressif.com:443/viewtopic.php?t=4048&p=12595#p12595 <![CDATA[Sample Codes • Re: Passive Scan on ESP8266(AP Beacon)]]> Statistics: Posted by Guest — Wed Apr 26, 2017 1:26 pm


]]>
2017-04-22T18:42:33+08:00 2017-04-22T18:42:33+08:00 https://bbs.espressif.com:443/viewtopic.php?t=4048&p=12498#p12498 <![CDATA[Sample Codes • Passive Scan on ESP8266(AP Beacon)]]>
passive scan.rar

Statistics: Posted by ESP_Kewal — Sat Apr 22, 2017 6:42 pm


]]>
2017-03-22T11:54:39+08:00 2017-03-22T11:54:39+08:00 https://bbs.espressif.com:443/viewtopic.php?t=3411&p=11540#p11540 <![CDATA[Sample Codes • Re: SDIO sample code]]>
Can ESP8266_NONOS_SDK/examples/at_sdio help you?

Download ESP8266 SDK

Thanks for your interest in ESP8266!

Statistics: Posted by ESP_Faye — Wed Mar 22, 2017 11:54 am


]]>
2017-03-10T01:52:16+08:00 2017-03-10T01:52:16+08:00 https://bbs.espressif.com:443/viewtopic.php?t=3411&p=11458#p11458 <![CDATA[Sample Codes • SDIO sample code]]> Statistics: Posted by kwoodbury1 — Fri Mar 10, 2017 1:52 am


]]>
2017-02-18T01:36:38+08:00 2017-02-18T01:36:38+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1346&p=11340#p11340 <![CDATA[Sample Codes • Re: [ESP8266] SPI as slave]]>
ESP_Faye wrote:
The attachment is a demo of SPI running as slave based on ESP8266_NONOS_SDK.

If using ESP8266_NONOS_SDK_V1.5.0 or later version, please add "-lcrypto" in 'LINKFLAGS_eagle.app.v6" area of the Makefile.

Documentation about SPI

附件为基于 ESP8266_NONOS_SDK 的 SPI slave 示例。

如果使用 ESP8266_NONOS_SDK_V1.5.0 或之后版本,请在示例的 Makefile 中 'LINKFLAGS_eagle.app.v6" 区域增加 "-lcrypto" 。

SPI 文档下载

Thanks for your interest in ESP8266 !


Hi,

I have one requirement in which ESP32 becomes as SPI Slave device for some communication with Master SPI device.

Also, We have e already started Development using ESP8266 RTOS SDK and I have checked in driver folder that Espressif Systems has not released SPI driver officially for RTOS SDK.

So, do you have any idea or sample SPI Slave driver with sample code? Does NONOS SPI driver can be ported and used into RTOS SDK?

Let me know for this ASAP as we have quick requirement for this for our project.

Regards,
Ritesh Prajapati

Statistics: Posted by ritesh — Sat Feb 18, 2017 1:36 am


]]>
2017-02-15T13:33:40+08:00 2017-02-15T13:33:40+08:00 https://bbs.espressif.com:443/viewtopic.php?t=3315&p=11314#p11314 <![CDATA[Sample Codes • Re: SDIO AT Comands]]> we have a document,you can consult it.
http://espressif.com/sites/default/file ... orm_en.pdf

Statistics: Posted by ESP_Xutao — Wed Feb 15, 2017 1:33 pm


]]>
2017-02-02T06:07:26+08:00 2017-02-02T06:07:26+08:00 https://bbs.espressif.com:443/viewtopic.php?t=3315&p=11221#p11221 <![CDATA[Sample Codes • SDIO AT Comands]]>
Someone have developed integration of esp-wroom-s2 with mcu?

What is needed?

Thanks

Statistics: Posted by lloureiro — Thu Feb 02, 2017 6:07 am


]]>
2016-11-09T17:21:28+08:00 2016-11-09T17:21:28+08:00 https://bbs.espressif.com:443/viewtopic.php?t=230&p=10478#p10478 <![CDATA[Sample Codes • Re: ESP8266 creates a UDP listening]]>
esp8266ac wrote:
能否提供基于RTOS SDK上的sample code?

在RTOS上我遇到的情况是espconn_init()调用后,不停的重启。不如直接用include/lwip下的lwip来直接实现,就跟socket编程一样。 :D

Statistics: Posted by mike.wu — Wed Nov 09, 2016 5:21 pm


]]>
2016-09-27T15:59:36+08:00 2016-09-27T15:59:36+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1393&p=9957#p9957 <![CDATA[Sample Codes • Re: [ESP8266] UART-TCP Passthrough Demo]]> Nothing to be done for `FORCE'.

Statistics: Posted by wangyi4422 — Tue Sep 27, 2016 3:59 pm


]]>
2016-09-27T11:28:26+08:00 2016-09-27T11:28:26+08:00 https://bbs.espressif.com:443/viewtopic.php?t=230&p=9954#p9954 <![CDATA[Sample Codes • Re: ESP8266 creates a UDP listening]]> espconn_get_connection_info should be invoked in user_udp_recv before ip_addr_netcmp
and reset the remote_ip & remote_port

Statistics: Posted by beyondhong — Tue Sep 27, 2016 11:28 am


]]>
2016-08-09T10:04:24+08:00 2016-08-09T10:04:24+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1378&p=8338#p8338 <![CDATA[Sample Codes • Re: [ESP8266] PWM Demo_For_ESP8266_NONOS_SDK]]>
遇到同样的问题,可以解决一下吗??

我使用这个PWM demo code时,当duty设置为0时,LED会有微弱光,不能关闭,用逻辑分析仪测得有1.6us的高电平每1000ms周期内,见附件图。但是duty为100时,PWM只有10ns的低电平,效果比SDK自带PWM库会好一点。为什么duty设置为0时,duty不为0?麻烦帮我解决。谢谢!

Statistics: Posted by pillarpeng — Tue Aug 09, 2016 10:04 am


]]>
2016-08-08T17:41:22+08:00 2016-08-08T17:41:22+08:00 https://bbs.espressif.com:443/viewtopic.php?t=389&p=8330#p8330 <![CDATA[Sample Codes • Re: ESP8266 as TCP SSL client]]> Statistics: Posted by gustavo — Mon Aug 08, 2016 5:41 pm


]]>
2016-07-23T21:41:44+08:00 2016-07-23T21:41:44+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2219&p=8080#p8080 <![CDATA[Sample Codes • Re: [ESP8266] I2C_Demo]]> have a look to elliot's post at hackaday
excelent infos about the ACK, NACK, 7 bit address and so on.
where you hang? what is the detailed problem?
how looks your arduino code?

best wishes
rudi ;-)

Statistics: Posted by rudi — Sat Jul 23, 2016 9:41 pm


]]>
2016-07-20T07:58:48+08:00 2016-07-20T07:58:48+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2219&p=8028#p8028 <![CDATA[Sample Codes • Re: [ESP8266] I2C_Demo]]>
scargill wrote:
..
I'm having trouble - I have an ESP8266 talking to Arduino.

hi pete, i understand you so , you use
ESP8266 as I2C Master
Arduino as I2C Slave
ok?
scargill wrote:
The ESP can send multiple bytes to the Arduino - no problem -
but I haven't a clue how to get multiple bytes back into the ESP.

so , do this:
you pulse the clk by esp8266 as master to the arduino and read the input on esp8266 sda what the i2c slave arduino send.

scargill wrote:
Repeated reads causes the ESP to crash so clearly I'm missing somebut I can't find anything out there - examples of using the SDK code for communications - indeed there aren't even any examples in the SDK.

Anyone familiar with this scenario??


pete, you must study first I2C Master and I2C Slave
there are ACK, NACK, LAST, Status, Start, Stop, ISR SDA, ISR CLK, Master Send, Slave Send..

example here is a I2C Slave

I2C_ESP_Slave.PNG


in the follow, there is a I2C Master ( ESP8266 ) and a I2C Slave ( ESP8266 ) ..
read in..
have a look into this thread
and study this

and here you can watch an example
I2C Slave is done in the past.

perhabs it helps to understand, how you must code the arduino ( I2C Slave )
that you can read by the Master ( ESP8266 ) from the Slave ( Arduino )
The SDA is the own pin for Master send and for Slave receive
also , for Slave send, and Master receive.
The direction is in the I2C standard protokol described






hope this helps.

best wishes
rudi ;-)

edit:
NONOS: read i2c_master.h
there are all your friends here what you need for read from Arduino,
you must code Arduino in the Arduino IDE as Slave with an address,
and this you send by ESP8266 as I2C Master to the Arduino,
and then you can read by the Master..:


Code:


void i2c_master_gpio_init(void);
void i2c_master_init(void);

void i2c_master_start(void);
void i2c_master_stop(void);

void i2c_master_setAck(uint8 level);
uint8 i2c_master_getAck(void);

uint8 i2c_master_readByte(void);
void i2c_master_writeByte(uint8 wrdata);

bool i2c_master_checkAck(void);
void i2c_master_send_ack(void);
void i2c_master_send_nack(void);



you must study I2C protokoll first, so you see the tree in the jungle what you search for :P

you start with a start by the master,
that do the sda low and then comes the clk
this is the begin of the protokoll,
"see start condition"
(if you do this with multi masters then you must check before, that bus is free with a check for SDA is high example..)
with a SDA low you signal in the bus, that you are will send data now.
after this , the bus is yours.

next ist the write byte,
you send the 7bit adress and shift in your command , want read << 1 or want write << 0
the slave check this
- address matching
- its a read or write

Code:

if ( Address & 1 ).. 


example a read,

then slave put the bits on at sda on each clk pulse ( 8 bits= 1 byte )
this is done, if the master reads a byte, because only the master can pulse the clk..
so
edit ( for better understanding )
the master read a Byte and on 9. clk cykle gives a ACK or NACK for the LAST

Code:

i2c_master_send_ack(void);


and the slave send data whilest the Master request it




// btw slave code..
/ edit

Code:


LAST = i2c_ArduinoSlave_TxByte(data);
while ( LAST == 0 )
// ACK = 0, NACK = 1
 


here you go on detailed:

proto.png


read here, take this:
http://www.ti.com/lit/an/slva704/slva704.pdf

and read carefull opendrain config

Statistics: Posted by rudi — Wed Jul 20, 2016 7:58 am


]]>
2016-07-19T00:33:23+08:00 2016-07-19T00:33:23+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2219&p=8010#p8010 <![CDATA[Sample Codes • Re: [ESP8266] I2C_Demo]]>
I'm having trouble - I have an ESP8266 talking to Arduino. The ESP can send multiple bytes to the Arduino - no problem - but I haven't a clue how to get multiple bytes back into the ESP. Repeated reads causes the ESP to crash so clearly I'm missing somebut I can't find anything out there - examples of using the SDK code for communications - indeed there aren't even any examples in the SDK.

Anyone familiar with this scenario??

Statistics: Posted by scargill — Tue Jul 19, 2016 12:33 am


]]>
2016-07-01T17:54:01+08:00 2016-07-01T17:54:01+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1378&p=7655#p7655 <![CDATA[Sample Codes • Re: [ESP8266] PWM Demo_For_ESP8266_NONOS_SDK]]>
我使用这个PWM demo code时,当duty设置为0时,LED会有微弱光,不能关闭,用逻辑分析仪测得有1.6us的高电平每1000ms周期内,见附件图。但是duty为100时,PWM只有10ns的低电平,效果比SDK自带PWM库会好一点。为什么duty设置为0时,duty不为0?麻烦帮我解决。谢谢!
pwm1.png

Statistics: Posted by JayYang — Fri Jul 01, 2016 5:54 pm


]]>
2016-06-23T22:01:12+08:00 2016-06-23T22:01:12+08:00 https://bbs.espressif.com:443/viewtopic.php?t=227&p=7484#p7484 <![CDATA[Sample Codes • Re: [ESP8266] SoftAP Config]]>
I am trying to connect to wifi with an iphone. Does that produce a specific problem?

Statistics: Posted by disideris — Thu Jun 23, 2016 10:01 pm


]]>