analogWriteFreq
?
esptool.py -p /dev/tty.usbserial-A9G7ZHP5 read_flash 0 0x80000 /tmp/dumb.bin
void ICACHE_RAM_ATTR uart_interrupt_handler(uart_t* uart) {
// -------------- UART 0 --------------
uint32_t status = U0IS;
if(Serial.isRxEnabled()) {
if(status & (1 << UIFF)) {
while(true) {
int rx_count = (U0S >> USTXC) & 0xff;
if(!rx_count)
break;
while(rx_count--) {
char c = U0F & 0xff;
Serial._rx_complete_irq(c);
}
}
U0IC = (1 << UIFF);
}
}
if(Serial.isTxEnabled()) {
if(status & (1 << UIFE)) {
U0IC = (1 << UIFE);
Serial._tx_empty_irq();
}
}
// -------------- UART 1 --------------
status = U1IS;
if(Serial1.isRxEnabled()) {
if(status & (1 << UIFF)) {
while(true) {
int rx_count = (U1S >> USTXC) & 0xff;
if(!rx_count)
break;
while(rx_count--) {
char c = U1F & 0xff;
Serial1._rx_complete_irq(c);
}
}
U1IC = (1 << UIFF);
}
}
if(Serial1.isTxEnabled()) {
status = U1IS;
if(status & (1 << UIFE)) {
U1IC = (1 << UIFE);
Serial1._tx_empty_irq();
}
}
}
void ICACHE_RAM_ATTR uart_interrupt_handler(uart_t* uart) {
// -------------- UART 0 --------------
if(Serial.isRxEnabled()) {
while(U0IS & (1 << UIFF)) {
Serial._rx_complete_irq((char)(U0F & 0xff));
U0IC = (1 << UIFF);
}
}
if(Serial.isTxEnabled()) {
if(U0IS & (1 << UIFE)) {
U0IC = (1 << UIFE);
Serial._tx_empty_irq();
}
}
// -------------- UART 1 --------------
if(Serial1.isRxEnabled()) {
while(U0IS & (1 << UIFF)) {
Serial1._rx_complete_irq((char)(U1F & 0xff));
U1IC = (1 << UIFF);
}
}
if(Serial1.isTxEnabled()){
if(U1IS & (1 << UIFE)) {
U1IC = (1 << UIFE);
Serial1._tx_empty_irq();
}
}
}
if(status & UART_RXFIFO_FULL_INT_ST) {
while(true) {
int rx_count = (READ_PERI_REG(UART_STATUS(0)) >> UART_RXFIFO_CNT_S) & UART_RXFIFO_CNT;
if(!rx_count)
break;
while(rx_count--) {
char c = READ_PERI_REG(UART_FIFO(0)) & 0xFF;
Serial._rx_complete_irq(c);
}
}
WRITE_PERI_REG(UART_INT_CLR(0), UART_RXFIFO_FULL_INT_CLR);
}
#include <ESP8266WiFi.h>
#define DBG_OUTPUT_PORT Serial1
#define MAX_SRV_CLIENTS 1
const char* ssid = "nbis-test";
const char* password = "1234567890";
WiFiServer server(21);
WiFiClient serverClients[MAX_SRV_CLIENTS];
/*
WiFiServer wwwserver(80);
void handleWWWClients(){
WiFiClient wwwserverClient = wwwserver.available();
if(!wwwserverClient) return;
while (wwwserverClient.connected() && !wwwserverClient.available()) delay(1);
while(wwwserverClient.available()) DBG_OUTPUT_PORT.write(wwwserverClient.read());
wwwserverClient.print("HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nConnection: close\r\n\r\nHello!\r\n");
}
*/
void handleClients(){
uint8_t i;
if (server.hasClient()){
for(i = 0; i < MAX_SRV_CLIENTS; i++){
if (!serverClients[i] || !serverClients[i].connected()){
if(serverClients[i]) serverClients[i].stop();
DBG_OUTPUT_PORT.print("Client Connected At: "); DBG_OUTPUT_PORT.println(i);
serverClients[i] = server.available();
return;
}
}
//no free spot
WiFiClient serverClient = server.available();
serverClient.stop();
}
for(i = 0; i < MAX_SRV_CLIENTS; i++){
if (serverClients[i] && serverClients[i].connected()){
if(serverClients[i].available()){
while(serverClients[i].available()) Serial.write(serverClients[i].read());
}
}
}
}
void messageAll(uint8_t * data, size_t len){
for(uint8_t i = 0; i < MAX_SRV_CLIENTS; i++){
if (serverClients[i] && serverClients[i].connected()){
serverClients[i].write(data, len);
delay(1);
}
}
}
void setup() {
Serial.begin(115200);
DBG_OUTPUT_PORT.begin(115200);
DBG_OUTPUT_PORT.setDebugOutput(true);
DBG_OUTPUT_PORT.print("\n");
WiFi.begin(ssid, password);
DBG_OUTPUT_PORT.print("Connecting to "); DBG_OUTPUT_PORT.println(ssid);
uint8_t i = 0;
while (WiFi.status() != WL_CONNECTED && i++ < 20) delay(500);
if(i == 21){
DBG_OUTPUT_PORT.print("Could not connect to"); DBG_OUTPUT_PORT.println(ssid);
while(1) delay(500);
}
DBG_OUTPUT_PORT.print("Connected! IP address: ");
DBG_OUTPUT_PORT.println(WiFi.localIP());
server.begin();
//wwwserver.begin();
DBG_OUTPUT_PORT.println("Server started");
}
void loop() {
handleClients();
//handleWWWClients();
if(Serial.available()){
size_t len = Serial.available();
uint8_t sbuf[len];
Serial.readBytes(sbuf, len);
messageAll(sbuf, len);
}
}
core_esp8266_wiring_pwm.c:(.text+0x12c): undefined reference to `qsort'
static __inline__ int _qsort(uint16_t *d, uint16_t l){
uint16_t i, j;
for (i = 1; i < l; i++) {
uint16_t tmp = d[i];
for (j = i; j >= 1 && tmp < d[j-1]; j--)
d[j] = d[j-1];
d[j] = tmp;
}
}
40214c9c <_ZN8SPIClass11writeBytes_EPhh>:
40214c9c: f0c112 addi a1, a1, -16
40214c9f: 01e9 s32i.n a14, a1, 0
40214ca1: ff5b21 l32r a2, 40214a10 <_ZN8SPIClass5beginEv+0x64>
40214ca4: 03ed mov.n a14, a3
40214ca6: ff5b31 l32r a3, 40214a14 <_ZN8SPIClass5beginEv+0x68>
40214ca9: 0161d2 s32i a13, a1, 4
40214cac: 3109 s32i.n a0, a1, 12
40214cae: 0261c2 s32i a12, a1, 8
40214cb1: 74d040 extui a13, a4, 0, 8
40214cb4: 0020c0 memw
40214cb7: 02c8 l32i.n a12, a2, 0
40214cb9: 10cc30 and a12, a12, a3
40214cbc: ff4c56 bnez a12, 40214cb4 <_ZN8SPIClass11writeBytes_EPhh+0x18>
40214cbf: 112dd0 slli a2, a13, 3
40214cc2: ffa005 call0 402146c4 <_ZN8SPIClass11setDataBitsEt$isra$0>
40214cc5: dd3b addi.n a13, a13, 3
40214cc7: 41d2d0 srli a13, a13, 2
40214cca: 0c2d mov.n a2, a12
40214ccc: fff351 l32r a5, 40214c98 <_ZN8SPIClass7write32Ej+0x28>
40214ccf: fff161 l32r a6, 40214c94 <_ZN8SPIClass7write32Ej+0x24>
40214cd2: 000306 j 40214ce2 <_ZN8SPIClass11writeBytes_EPhh+0x46>
40214cd5: 346a add.n a3, a4, a6
40214cd7: 3e3a add.n a3, a14, a3
40214cd9: 0338 l32i.n a3, a3, 0
40214cdb: 221b addi.n a2, a2, 1
40214cdd: 0020c0 memw
40214ce0: 0439 s32i.n a3, a4, 0
40214ce2: 425a add.n a4, a2, a5
40214ce4: 743020 extui a3, a2, 0, 8
40214ce7: 1144e0 slli a4, a4, 2
40214cea: e79d37 bne a13, a3, 40214cd5 <_ZN8SPIClass11writeBytes_EPhh+0x39>
40214ced: ff4821 l32r a2, 40214a10 <_ZN8SPIClass5beginEv+0x64>
40214cf0: ff4931 l32r a3, 40214a14 <_ZN8SPIClass5beginEv+0x68>
40214cf3: 0020c0 memw
40214cf6: 0248 l32i.n a4, a2, 0
40214cf8: 204430 or a4, a4, a3
40214cfb: 0020c0 memw
40214cfe: 0249 s32i.n a4, a2, 0
40214d00: 0020c0 memw
40214d03: 0248 l32i.n a4, a2, 0
40214d05: f78437 bany a4, a3, 40214d00 <_ZN8SPIClass11writeBytes_EPhh+0x64>
40214d08: 3108 l32i.n a0, a1, 12
40214d0a: 21c8 l32i.n a12, a1, 8
40214d0c: 11d8 l32i.n a13, a1, 4
40214d0e: 01e8 l32i.n a14, a1, 0
40214d10: 10c112 addi a1, a1, 16
40214d13: f00d ret.n
40214d15: 000000 ill
Upload: START, filename: /test.jpg
Fatal exception (9):
epc1=0x40214cd9, epc2=0x00000000, epc3=0x00000000, excvaddr=0x3ffea8b6, depc=0x00000000
if(!data) {
os_printf("NULL PTR in writeBytes_ ");
return;
}
Upload: START, filename: /test.jpg
Fatal exception (9):
epc1=0x40214ced, epc2=0x00000000, epc3=0x00000000, excvaddr=0x3ffea8d6, depc=0x00000000
void SPIClass::writeBytes_(uint8_t * data, uint8_t size) {
while(SPI1CMD & SPIBUSY) {}
// Set Bits to transfer
setDataBits(size * 8);
volatile uint32_t * fifoPtr = &SPI1W0;
uint32_t * dataPtr = (uint32_t*) data;
uint8_t dataSize = ((size + 3) / 4);
os_printf("[SPIClass::writeBytes_] data: 0x%08X size: %d dataSize: %d\n", data, size, dataSize);
delay(100);
while(dataSize--) {
*fifoPtr = *dataPtr;
dataPtr++;
fifoPtr++;
}
SPI1CMD |= SPIBUSY;
while(SPI1CMD & SPIBUSY) {}
}
[SPIClass::writeBytes_] data: 0x3FFE9E5C size: 64 dataSize: 16
[SPIClass::writeBytes_] data: 0x3FFE9E9C size: 64 dataSize: 16
[SPIClass::writeBytes_] data: 0x3FFEA9EA size: 64 dataSize: 16
Fatal exception (9):
epc1=0x40214cf9, epc2=0x00000000, epc3=0x00000000, excvaddr=0x3ffea9ea, depc=0x00000000
data: 0x3FFE9E94 size: 64 dataSize: 16 fifo:0x60000140
data: 0x3FFEA8EE size: 64 dataSize: 16 fifo:0x60000140
Fatal exception (9):
epc1=0x40214cf5, epc2=0x00000000, epc3=0x00000000, excvaddr=0x3ffea8ee,
fifo: 0x60000168 64x5
fifo: 0x6000016C 64x4
fifo: 0x60000170 64x3
fifo: 0x60000174 64x2
fifo: 0x60000178 64x1
fifo: 0x6000017C 64x0
fifo: 0x60000140 64x15
Fatal exception (9):
epc1=0x40214cfa, epc2=0x00000000, epc3=0x00000000, excvaddr=0x3ffea8ce, depc=0x00000000
SD Card initialized.
Upload: filename: /reivilo.png
Upload: data: 4
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 1460
Upload: data: 29
Upload: data: 1460
Fatal exception (9):
epc1=0x40214cf5, epc2=0x00000000, epc3=0x00000000, excvaddr=0x3ffea817, depc=0x00000000
#define PROGMEM ICACHE_RODATA_ATTR
#define PGM_P const char *
#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];}))