-->
Page 12 of 13

Re: Arduino code on the ESP8266?

PostPosted: Wed Jan 07, 2015 4:46 am
by samehhady
Karang, some requests from me that would be so great if it can be implemented.

- EPPROM ( EEPROM.read(), EEPROM.write() )
- Web Sockets or MQTT which would work like:

client.connect(server);
client.monitor();
client.send("Hello World!");
client.setDataArrivedDelegate(dataArrived);

That would be seriously great.

- Some ESP info like heap, id, etc.

Re: Arduino code on the ESP8266?

PostPosted: Mon Jan 12, 2015 12:31 am
by RobNewton
Great work. Are the binaries generic enough to share or do I need to compile specifically for my ESP? If they are generic, could someone upload them?

Once burned onto the ESP, does the firmware allow for uploading sketches over serial just like an Arduino, or do the sketches have to be compiled into the firmware?

Re: Arduino code on the ESP8266?

PostPosted: Tue Jan 13, 2015 6:58 am
by hreintke
@Karang
I was/am working on getting interrupt based GPIO working in RTOS SDK.
Took your code from wiring.c as a base but that resulted in constant reboots when active.
Also noticed your questions in the esp_iot_rtos_sdk on github.

Don't know whether you already got it work correctly after a lot of reading/testing/combining I finally may have a solution.
Looks like _xt_read_ints() does not return the interrupt status. Updated it to read the register directly.
Same for clear interrupt status and _xt_clear_ints(gpio_mask)

See here for my version of your interrupthandler :
Code: Select allLOCAL void interruptHandler() {
    uint32 gpio_mask = _xt_read_ints();
    uint32_t gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS);
    printf("Generic interrupt gpio_mask= 0x%08x, status = 0x%08x\n",gpio_mask,gpio_status);
    for (int i=0 ; i<16 ; i++) {
        if ((0x1<<i) & gpio_status) {
           printf("Mask set %d\n",i);
            if (callbacks[i] != NULL) {
               printf("Callback %d\n",i);
                (*callbacks[i])();
            }
        }
    }
//    _xt_clear_ints(gpio_mask);
//    gpio_intr_ack(gpio_mask);
    //clear interrupt status
    GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, gpio_status );
}


Herman

Re: Arduino code on the ESP8266?

PostPosted: Tue Jan 13, 2015 9:49 pm
by Karang
@samehhady : The esp8266 doesn't have EEPROM but I started an SpiFlash library wich intends to do the same. For the protocols libraries I think I will provide a low level api to access the sockets and let the users develop libraries on it.

@RobNewton : Unfortunatly the binaries are not generic at all. The sketchs need to be compiled (just like on the Arduino). I try to put as much sdk code as I can in the sdk part of the memory so we could avoid uploading the sdk bin each time.

@hreintke : Good job ! Thanks to you it seems to be fixed. I need to run some tests but it doesn't crash anymore and produce a coherent result. I'll see if we could use that to unblock the pwm part.

Yesterday we received a custom board that a friend at my lab made. It will not be required to use the software part of Ardunet but it will offer a good starter kit. It contains a usb-uart chip and a voltage regulator and it give access to the gpio in a breadboard-friendly way ! The board is based on the esp-12 but Ardunet doesn't depends on the module.

Image

Thank you all for your support !