These are chat archives for esp8266/Arduino

21st
Aug 2016
probonopd
@probonopd
Aug 21 2016 00:11
@all if you have some time, watch CNLohr do his magic in this livestream right now https://www.youtube.com/watch?v=cwtAMBo3efs
Stavros Korokithakis
@skorokithakis
Aug 21 2016 00:21
what is he doing?
probonopd
@probonopd
Aug 21 2016 00:22
he's the guy who built USB for the ESP, right now it seems like he is emulating USB HID devices (although I just tuned in right now and don't have the full context yet)
Stavros Korokithakis
@skorokithakis
Aug 21 2016 00:23
oh, that's very interesting
looks like he's turning the ESP into an AP, connecting to that, showing a webpage with a keyboard and that's emulating a HID kb
to the host
probonopd
@probonopd
Aug 21 2016 00:23
yes something like that
Stavros Korokithakis
@skorokithakis
Aug 21 2016 00:23
i didn't know there's USB for the ESP, do you have a link?
Stavros Korokithakis
@skorokithakis
Aug 21 2016 00:24
thank you
Stavros Korokithakis
@skorokithakis
Aug 21 2016 00:24
@gmag11 thanks for the programmer tip, i wouldn't have debugged this otherwise, it works now!
probonopd
@probonopd
Aug 21 2016 00:24
including a background video on how he did the USB
Stavros Korokithakis
@skorokithakis
Aug 21 2016 00:26
that's quite impressive actually
kitmaker
@kitmaker
Aug 21 2016 05:13
AnyBody Knows how to Set ESP to Communicate Over TCP from Internet?
Me No Dev
@me-no-dev
Aug 21 2016 05:25
@kitmaker have you looked at the examples?
kitmaker
@kitmaker
Aug 21 2016 05:50
Nope. But i Saw UdpNtp Example. and WebClient.ino - I am a Intermediate Can you Give some Guidance ?
Germán Martín
@gmag11
Aug 21 2016 08:29
@skorokithakis you're welcome. Good morning.
Clemens Kirchgatterer
@everslick
Aug 21 2016 08:29
what was eventually the problem with your serial com? @skorokithakis
Stavros Korokithakis
@skorokithakis
Aug 21 2016 08:51
@everslick I am not sure... What I changed was that I had connection.print("\r") and changed it to connection.write('\r')
Not sure how that changes anything, though
Clemens Kirchgatterer
@everslick
Aug 21 2016 08:55
odd. write() might be 'slightly' faster though, and by slightly i mean 'not relevant' at all usually.
Stavros Korokithakis
@skorokithakis
Aug 21 2016 09:04
Yes 🙁 I don't know what happened, could it have been the single quotes?
Stavros Korokithakis
@skorokithakis
Aug 21 2016 09:10
Here's the commit that worked skorokithakis/A6lib@158e69e
Clemens Kirchgatterer
@everslick
Aug 21 2016 12:52
making real mobile data connections would be fun though. :)
Germán Martín
@gmag11
Aug 21 2016 13:17
@everslick @skorokithakis Most AT commands should be compatible, so this library could be ported easily. I would prefer a library that inherits Client to have a similar interface as WiFiClient, but this would be a great effort.
Stavros Korokithakis
@skorokithakis
Aug 21 2016 13:19
@everslick thanks for that link, i'm actually trying to get SMS reading working so that's a great help
@gmag11 yeah, that would be fantastic but i'm very new with C and i don't currently have a need for TCP over GSM, so i'm leaving that for someone else to implement :P
would be great if someone refactored the library to use more idioms, though
Holger Lembke
@holgerlembke
Aug 21 2016 13:29
I fail on the simplest things.... I have a library with a h/cpp and want to use Serial.println(); So I add #include <Arduino.h> and compiler still complains. Why?
kiralikbeyin
@kiralikbeyin
Aug 21 2016 13:32
@holgerlembke you forgot to add or remove "{" or "}"
Holger Lembke
@holgerlembke
Aug 21 2016 13:34
could by my level of todays stupidity. but no. If I comment out the line with // everyone is happy.
It totally dislikes "Serial."
kiralikbeyin
@kiralikbeyin
Aug 21 2016 13:35
copy sketch here please
Holger Lembke
@holgerlembke
Aug 21 2016 13:35
DSTATUS disk_initialize (void)
{
    //Serial.println("INIT");
    return STA_NOINIT;    // disk has not been initilized, so do it
}
kiralikbeyin
@kiralikbeyin
Aug 21 2016 13:40
#define DBG_OUTPUT_PORT Serial
maybe this helps
Germán Martín
@gmag11
Aug 21 2016 13:42
It should work, have you selected the right board on IDE?
What's the error that compiler throws?
Holger Lembke
@holgerlembke
Aug 21 2016 13:43
as I said. stupid. It was a .c file.
Now it is a .cpp file and all complains are gone.
Germán Martín
@gmag11
Aug 21 2016 13:48
Well done. I didn't know it was important.
Holger Lembke
@holgerlembke
Aug 21 2016 13:51
it is. compiler handles .c and .cpp different, as we have here seen by example. :-)
Germán Martín
@gmag11
Aug 21 2016 13:51
Good to know :-)
Martin Ayotte
@martinayotte
Aug 21 2016 13:53
Of course, Serial is a C++ class, so any Plain C files will choke with it
In case, you need to debug a Plain C file, you need to create your own extern "C" function such dbg_print(...) in your main sketch and use it in the Plain C
Germán Martín
@gmag11
Aug 21 2016 13:55
:+1:
Holger Lembke
@holgerlembke
Aug 21 2016 13:56
or rename it to .cpp
Stavros Korokithakis
@skorokithakis
Aug 21 2016 15:01
does anyone know why my terminal might be closing the serial connection, even though the ESP is working? i've never seen that before
Holger Lembke
@holgerlembke
Aug 21 2016 15:11
did you try turning everything off and on again?
Stavros Korokithakis
@skorokithakis
Aug 21 2016 15:17
hell, i wrote a function to turn everything off and on again
hey, does anyone know of a way to toggle a code block on and off using comments?
(or did i just invent one?)
    /*
    commented
    // */
    //*
    uncommented
    // */
Holger Lembke
@holgerlembke
Aug 21 2016 15:22
I use /**/
to surround it. add a space after the ** to turn off
Stavros Korokithakis
@skorokithakis
Aug 21 2016 15:23
ah, that works too, thanks
probonopd
@probonopd
Aug 21 2016 15:26
anyone interested in infrared remote codes sending, check out my new sketch https://github.com/probonopd/ESP8266iTachEmulator
Stavros Korokithakis
@skorokithakis
Aug 21 2016 16:01
hmm, whenever i make a GSM call, the serial connection drops. could it be because there's too much noise?
@probonopd that looks pretty cool, thanks!
Stavros Korokithakis
@skorokithakis
Aug 21 2016 16:19
does anyone know if GSM noise may cause the serial connection to be closed?
Holger Lembke
@holgerlembke
Aug 21 2016 16:22
how far away is sending device from usb cable/chips?
perhaps a little bit too much energy?
Do I have to erase flash before using SPIWrite?
Stavros Korokithakis
@skorokithakis
Aug 21 2016 16:34
is it okay if i connect USB to the wemos and connect the 5v rail to 5v input?
i mean connect +5v to vcc
Holger Lembke
@holgerlembke
Aug 21 2016 16:36
as an engineer I would say: lets do our sunday experiment....
Stavros Korokithakis
@skorokithakis
Aug 21 2016 16:36
sorry @holgerlembke, possibly a bit too much energy, yes
i am wondering whether it's drawing too much power, so now i'm trying to connect it to an external power supply
i'm not sure about SPI, sorry
Holger Lembke
@holgerlembke
Aug 21 2016 16:38
it looks like there is a diode in the usb pwr path...
Stavros Korokithakis
@skorokithakis
Aug 21 2016 16:39
yeah, there is, but i'd prefer not to blow it :)
Clemens Kirchgatterer
@everslick
Aug 21 2016 16:39
@holgerlembke @skorokithakis the generic way is to put #if 0 ... #endif around codeblocks that should temporarily be shut off.
Stavros Korokithakis
@skorokithakis
Aug 21 2016 16:39
@everslick yes, but this is less typing :P
Clemens Kirchgatterer
@everslick
Aug 21 2016 16:40
becaus it works even if you have / / style comments within that block
Stavros Korokithakis
@skorokithakis
Aug 21 2016 16:40
ah, true
Clemens Kirchgatterer
@everslick
Aug 21 2016 16:40
/* */ i mean
Stavros Korokithakis
@skorokithakis
Aug 21 2016 16:40
yes
Clemens Kirchgatterer
@everslick
Aug 21 2016 16:41
some IDEs support commenting out whole blocks that way with a shortcut
Holger Lembke
@holgerlembke
Aug 21 2016 16:42
@skorokithakis ok, positiv, there is a diode in the usb path...
Stavros Korokithakis
@skorokithakis
Aug 21 2016 16:42
@holgerlembke thanks, i realized i only have to power the A6 with the external power supply and removed the wemos from the 5v anyway :P
which one is the diode?
ah, D2
great, thanks
i am worried about the fact that the serial connection drops, though... if this is because of noise, i might be screwed
are there any special considerations when routing a PCB that will have an SMA antenna on it?
Holger Lembke
@holgerlembke
Aug 21 2016 16:44
four layers :-)
Stavros Korokithakis
@skorokithakis
Aug 21 2016 16:44
why?
Holger Lembke
@holgerlembke
Aug 21 2016 16:44
ground in the middle as shielding
Stavros Korokithakis
@skorokithakis
Aug 21 2016 16:45
hmm, shielding against what?
Holger Lembke
@holgerlembke
Aug 21 2016 16:45
oh, i thought you want gsm and esp on one board...
Stavros Korokithakis
@skorokithakis
Aug 21 2016 16:45
i do
but why four layers?
Holger Lembke
@holgerlembke
Aug 21 2016 16:46
because you cant create a shield with two layers
Stavros Korokithakis
@skorokithakis
Aug 21 2016 16:46
hmm, why not?
hm
i guess i don't know what needs shielding
Holger Lembke
@holgerlembke
Aug 21 2016 16:47
and I guess I'm the wrong person to dispense knowledge in that field...
i'm still asking: do I need to erase flash before writing?
Stavros Korokithakis
@skorokithakis
Aug 21 2016 16:48
hm
@holgerlembke i never erase flash
you mean before flashing your program to the ESP?
Holger Lembke
@holgerlembke
Aug 21 2016 16:54
no, direct flash access from my program.
I try to find how @igrr implemented the read/write in SPIFFS but it is Fail-Day today.
ah. found it.
Stavros Korokithakis
@skorokithakis
Aug 21 2016 17:02
ah, i don't think you need to erase the flash, as long as you don't try to read meaningful stuff from an uninitialized address
Holger Lembke
@holgerlembke
Aug 21 2016 17:18
This message was deleted
void writestuff(const BYTE *data, int len) {
  SPIWrite(0x10000,data,len);
}
this wont compile. i understand why. but how to change? the declarations have to be that way, because they are defined that way....
Stavros Korokithakis
@skorokithakis
Aug 21 2016 17:20
what's the error?
Holger Lembke
@holgerlembke
Aug 21 2016 17:20
invalid conversion from 'const void' to 'void
because SPIWrite(uint32_t addr, void *src, size_t size);
Germán Martín
@gmag11
Aug 21 2016 17:21
Remove *
Holger Lembke
@holgerlembke
Aug 21 2016 17:21
both calls are fixed. no way to change them.
Germán Martín
@gmag11
Aug 21 2016 17:22
I read wrong, forget it
Holger Lembke
@holgerlembke
Aug 21 2016 17:26
hmmm. const_cast<byte*>data makes the compiler happy.
Martin Ayotte
@martinayotte
Aug 21 2016 17:53
SPIWrite(0x10000,(void *)data,len);
Germán Martín
@gmag11
Aug 21 2016 18:57
@skorokithakis I tried some examples of GSM/GPRS library from http://www.gsmlib.org
They compile with ESP8266 board
So we only have to find AT commands incompatibilities to make it work with A6
@skorokithakis Could you test if basic features like GSM registration work?
Holger Lembke
@holgerlembke
Aug 21 2016 19:07
void checkreadwritecalls(void) {
    byte buffer[512] = {1,2,3,4,5,6,7,8,9,10};
    byte read[512];

    SPIWrite(0x100000,buffer,512);
    SPIRead(0x100000,read,512);

  for (int i=0;i<10;i++) {
      Serial.print(read[i]);
      Serial.print(" ");
  }
  Serial.println();    
}
I have a esp-12, so I should be able to write at that pos. right?
Stavros Korokithakis
@skorokithakis
Aug 21 2016 19:13
@gmag11 i tried that, it worked fine with my Sim900 but couldn't get it to work with the A6
however, maybe i was doing something dumb, i don't know
i knew much less about the a6 than i do now
i'm having many problems with it, dropped Serial connections, the speaker doesn't always work during phone calls, i can't get SMS, etc etc
although i did make a simple breakout board, if you want to give it a shot: http://dirtypcbs.com/view.php?share=24821&accesskey=05a331a25db53838a0b6d8478ad5ef0e
integrated ESP + A6, mic/headphone jack, breakout pins
Germán Martín
@gmag11
Aug 21 2016 19:15
Don't worry for now. I needed a quick test only, thanks. Have a look to that lib to see if it has all that is needed
Stavros Korokithakis
@skorokithakis
Aug 21 2016 19:15
np
i will try it
Germán Martín
@gmag11
Aug 21 2016 19:15
Then we will have to do some debugging to adapt it to A6
Stavros Korokithakis
@skorokithakis
Aug 21 2016 19:16
the AT set is compatible, though, that's where i'm reading the commands from
@gmag11 i don't know, my library works well enough for now
Germán Martín
@gmag11
Aug 21 2016 19:16
I've seen it uses soft serial
Stavros Korokithakis
@skorokithakis
Aug 21 2016 19:16
the code for the gsmlib was pretty dirty
yes
Germán Martín
@gmag11
Aug 21 2016 19:17
I've haven't got good experience with soft serial
Stavros Korokithakis
@skorokithakis
Aug 21 2016 19:17
it's been okay so far for me, i think
Germán Martín
@gmag11
Aug 21 2016 19:17
But, probably it was my fault
Stavros Korokithakis
@skorokithakis
Aug 21 2016 19:17
you have to reduce the baud rate to something low, like 9600
115200 is too high
Germán Martín
@gmag11
Aug 21 2016 19:18
I see
I used 57600
And I lost may
Many bytes
Stavros Korokithakis
@skorokithakis
Aug 21 2016 19:19
ah :/
were you doing TCP?
Germán Martín
@gmag11
Aug 21 2016 19:19
With hardware serial it worked ok. I did not investigate yet
No, raw serial. For my Firmata lib
Stavros Korokithakis
@skorokithakis
Aug 21 2016 19:19
oh, hmm, that's odd
for my AT commands it's been behaving ok
Germán Martín
@gmag11
Aug 21 2016 19:20
But data flow is constant
Martin Ayotte
@martinayotte
Aug 21 2016 19:20
@holgerlembke , before the SPIWrite(), did you call to SPIEraseSector() ? because Flashes are not easily writable like EEPROM ...
Stavros Korokithakis
@skorokithakis
Aug 21 2016 19:20
right
maybe i just didn't transfer that much data
if i see a problem with the softserial, i'll switch to onboard serial, but for now it's ok
(i.e. i'm having much more problems with other things)
Germán Martín
@gmag11
Aug 21 2016 19:21
I will try to find some time to test that gprs lib and adapt commands to A6
Stavros Korokithakis
@skorokithakis
Aug 21 2016 19:21
let me know, it'd be nice if you could contribute to my lib
Holger Lembke
@holgerlembke
Aug 21 2016 19:37
@martinayotte I changed it...
void checkreadwritecalls(void) {
    byte buffer[512] = {1,2,3,4,5,6,7,8,9,10};
    byte read[512];

    SPIEraseSector(0x100000/0x1000);
    delay(100);
    SPIWrite(0x100000,buffer,512);
    delay(100);
    SPIRead(0x100000,read,512);

  for (int i=0;i<10;i++) {
      Serial.print(read[i]);
      Serial.print(" ");
  }
  Serial.println();    
}
still does not work
moving to SPIEraseAreaEx doesnt help....
Mehrdad K
@mkeyno
Aug 21 2016 19:43
@holgerlembke why you need to use delay
Holger Lembke
@holgerlembke
Aug 21 2016 19:44
no idea. i added it randomly, fishing for problems.. perhaps the electrons need to settle... :-)
Mehrdad K
@mkeyno
Aug 21 2016 19:45
you may aware the SPIWrite disable and enable interrupt
Holger Lembke
@holgerlembke
Aug 21 2016 19:53
now I have this not working solution:
static const int FLASH_INT_MASK = ((B10 << 8) | B00111010);

/*-----------------------------------------------------------------------*/
void checkreadwritecalls(void) {
    byte buffer[512] = {1,2,3,4,5,6,7,8,9,10};
    byte read[512];

    ets_isr_mask(FLASH_INT_MASK);
    SPIEraseAreaEx(0x100000,512);
    SPIWrite(0x100000,buffer,512);
    SPIRead(0x100000,read,512);
    ets_isr_unmask(FLASH_INT_MASK);

  for (int i=0;i<10;i++) {
      Serial.print(read[i]);
      Serial.print(" ");
  }
  Serial.println();    
}
Holger Lembke
@holgerlembke
Aug 21 2016 20:48
hmm. moving to spi_flash_write and it works.
0xPIT
@0xPIT
Aug 21 2016 21:20
Hi. Anyone know why rom_i2c_readReg_Mask can not be linked? it is used in https://github.com/esp8266/Arduino/blob/master/cores/esp8266/esp8266_peri.h#L752 but when I call the macro, I get undefined reference to rom_i2c_writeReg_Mask(...)' collect2: error: ld returned 1 exit status
Stavros Korokithakis
@skorokithakis
Aug 21 2016 21:20
i highly highly suggest https://gitlab.com/stavros/espota-server with http updates if you have devices around the house
i add a "reboot" commands to a general topic, and all the devices get updated with the latest firmware
what ohm resistors do you use in series with your usual SMD LEDs?
Martin Ayotte
@martinayotte
Aug 21 2016 21:26
That depends of the SMD LED brightness. I'm usually using 1K.
Stavros Korokithakis
@skorokithakis
Aug 21 2016 21:27
ah, thanks
i got a value of 150 Ω but i wasn't sure if it was too high
looks like it's not!
also, in the diode, the arrow points towards GND, right?
also in a LED
Martin Ayotte
@martinayotte
Aug 21 2016 21:29
With 150R, it will glow too much ! :-) Yes, arrow is the direction of current.
Stavros Korokithakis
@skorokithakis
Aug 21 2016 21:45
ah, i'll make it a larger one, thanks martin
0xPIT
@0xPIT
Aug 21 2016 21:45
Hm 1k sounds too much for regular LEDs with 3,3V... but most SMD LEDs might be Low-Current these days. @skorokithakis Use something like this: http://www.ohmslawcalculator.com/led-resistor-calculator. Regular LEDs are already bright enough at ~5mA. Voltage drop across the LED is 1.5-2V, depending on color.
Stavros Korokithakis
@skorokithakis
Aug 21 2016 21:46
@0xPIT yeah, i think SMD LEDs are 1.6 V
@0xPIT i used something like that, that's where i got the 150 Ω. i used 20 mA for the LED, as i don't know how much current it needs
0xPIT
@0xPIT
Aug 21 2016 21:46
the voltage drop depends on material == color. Blue will be more like 2V, red more like 1.5V.
Stavros Korokithakis
@skorokithakis
Aug 21 2016 21:47
yeah, i used this one, which has a handy table: http://ledcalculator.net/
let's hope i don't have any mistakes on my quick-and-dirty A6 dev board
0xPIT
@0xPIT
Aug 21 2016 21:48
here's a color vs. voltage chart: http://www.oksolar.com/led/led_color_chart.htm
Stavros Korokithakis
@skorokithakis
Aug 21 2016 21:48
ah, very helpful, thanks
there's a lot of variance, blue is almost twice the voltage of IR
0xPIT
@0xPIT
Aug 21 2016 21:49
yep.
Stavros Korokithakis
@skorokithakis
Aug 21 2016 21:49
i'm guessing "ultra blue" are those dreadful ones that appear out of focus
0xPIT
@0xPIT
Aug 21 2016 21:49
so too large resistor, and it won't light up at all.
Stavros Korokithakis
@skorokithakis
Aug 21 2016 21:49
yep
Stavros Korokithakis
@skorokithakis
Aug 21 2016 22:26
@martinayotte do you know why my usb/hwserial connection drops whenever the A6 tries to talk to the network? too much power draw, too much RF noise?
and i don't know how to power my circuit up from a power source while still using the usb serial...
Germán Martín
@gmag11
Aug 21 2016 22:49
Probably too much power draw.
Do you have an oscilloscope?
Stavros Korokithakis
@skorokithakis
Aug 21 2016 22:55
no, amp meter, but if i connect the A6 to an external power source to measure current, it refuses to respond
btw it draws 120 mA tops
Comino
@cominous_twitter
Aug 21 2016 23:53

Hey guys,

Im a bit lost - I want to get the MAC address from a known IP device. I found out, that lwip_gcc does that with an ARP implementation.
https://github.com/esp8266/Arduino/blob/master/tools/sdk/lwip/src/netif/etharp.c => "find_entry() should be the function I need.

Its declared "local" (according to objdump)
No header is declaring it - so afaik - All I need to do is to :
extern s8_t ICACHE_FLASH_ATTR find_entry(ip_addr_t *ipaddr, u8_t flags);
In one of my header... and I made sure its linkin with liblwip_gcc.a
But still it throws a linker error
"undefined.. ."
Some any idea or an alternative idea, how I can get the MAC address?