These are chat archives for esp8266/Arduino

15th
Nov 2015
frippe75
@frippe75
Nov 15 2015 12:57
@me-no-dev thanks for yesterdays chat! I'm testing out the AVRISP (SPI) example and just want to come back to yesterdays discussion. I have selected GPIO16 pin on the ESP12e to be the reset. One thing I failed to understand was about SS and Reset. Do I connect my GPIO16 on the ESP to both Reset and SS on the ATmega...? I might want to have multiple AVR's connected to the ESP12e, thats why I'm a bit short on pins...
If I was using a single AVR I probably could put the SS directly to ground?
Me No Dev
@me-no-dev
Nov 15 2015 13:51
SS on AVR is osed only whet the AVR is the SPI master
in your case the AVR is a slave device
so the SS on the ESP(you selected it to be 16) will be connected to the reset pin of the AVR
SS pin on avr does not play any role in programming
for more AVRs to be connected you can use different SS pins on the ESP for each
SS stands for SlaveSelect
frippe75
@frippe75
Nov 15 2015 14:12

Ok I though that's what I wrote :-)

  • GPIO16 is for Reset and SS pin of AVR1

then having a second AVR2:

  • GPIO15 is for Reset and SS pin of AVR2.

Rest of the SPI pins are connected using the same pins on both AVR's

Correct?

But you wrote "SS pin on avr does not play any role in programming". Not really clear about that.
AVR design guides talk about using the SCK to hide multiple AVR's behind single ISP.
But that seems difficult to impl. in software on the ESP side.
Maybe time for breadboard test. Sorry if this is abit off-topic for this forum!
Me No Dev
@me-no-dev
Nov 15 2015 15:25
You are getting me all confused again :D
we are talking about programming AVR chiips behind ESP8266 correct?
on the ICSP header there are 6 pins and those are the only needed pins on the AVR to get it programmed
those pins are: RST, SCK, MISO, MOSI, GND and VCC
the programmer side (wether its ESP or whatever ICSP programmer) uses also 6 pins to connect to the AVR
those pins are: SS, SCK, MISO, MOSI, GND and VCC
the latter 5 pins are common for each AVR that you want to connect, SS pin is what needs to be different for each AVR simultaneously connected to the same programmer
SCK, MISO, MOSI, GND and VCC are common pins
depending on which SS you strigger, is which AVR will be programmed
but those are really things you should know before embarking on such adventure
@Links2004 @igrr you guys around?
Me No Dev
@me-no-dev
Nov 15 2015 15:30
I'm having real issue trying to emit multicast packets from the ESP
I have MDNS on and working fine, but my other service does not want to send anything
says it's sending but nothing gets to the network
receives fine multicast packets on that IP/port though
just does not send
it did for a bit at some point but that was short moment
code is the same as any other multicast service we have
Me No Dev
@me-no-dev
Nov 15 2015 15:51

bool Multicaster::begin(IPAddress multicast_ip, uint16_t port, uint32_t ttl){
  if (_server)
    return true;

  struct ip_info local_ip;
  int mode = wifi_get_opmode();
  if(mode & STATION_MODE){
    wifi_get_ip_info(STATION_IF, &local_ip);
  } else if (mode & SOFTAP_MODE) {
    wifi_get_ip_info(SOFTAP_IF, &local_ip);
  } else {
    return false;
  }

  _multicast_addr = (uint32_t) multicast_ip;
  _multicast_port = port;

  ip_addr_t maddr;
  maddr.addr = (uint32_t) multicast_ip;
  if (igmp_joingroup(&local_ip.ip, &maddr) != ERR_OK)
    return false;

  _server = new UdpContext;
  _server->ref();

  if (!_server->listen(*IP_ADDR_ANY, _multicast_port))
    return false;

  _server->setMulticastInterface(local_ip.ip);
  _server->setMulticastTTL(ttl);
  _server->onRx(std::bind(&Multicaster::_onRx, this));
  return _server->connect(maddr, _multicast_port);
}

size_t Multicaster::send(uint8_t *data, size_t len){
  _server->append(reinterpret_cast<const char*>(data), len);
  _server->send();
  return len;
}
Markus
@Links2004
Nov 15 2015 16:30

@me-no-dev at which mode do you use the WiFi AP or STA or both?

If i compare you code to the WiFiUdp the order looks wrong to me.
arduino code tx:

            WiFiUDP udpTx;
            udpTx.beginPacketMulticast(ipMulti, UDP_QUAD_TO_RC, WiFi.softAPIP());
            udpTx.write(&buf[0], size);
            udpTx.endPacket();
will end in something like this:
Me No Dev
@me-no-dev
Nov 15 2015 16:33
the order of what?
i copied the code from mDNS and checked with DNSSD
SSDP i'm sorry
Markus
@Links2004
Nov 15 2015 16:33
 _server->setMulticastInterface(local_ip.ip);
  _server->setMulticastTTL(ttl);
  _server->onRx(std::bind(&Multicaster::_onRx, this));
  return _server->connect(maddr, _multicast_port);
compared to this:
https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/src/WiFiUdp.cpp#L174-L184
ok so you try to make it run in backround
Me No Dev
@me-no-dev
Nov 15 2015 16:34
I got it to emit packets, but only if size is under 512Bytes
Markus
@Links2004
Nov 15 2015 16:36
do you run latest git.
it is may connected to this bug #1009
Me No Dev
@me-no-dev
Nov 15 2015 16:40
yup
that's actually it
thanks!