Advanced Users can post their questions and comments here for the not so Newbie crowd.

Moderator: eriksl

User avatar
By QuickFix
#95474
@xi@g@me wrote:Took me a long time, but I got it! :mrgreen:

Glad you figured it out. 8-)
This all goes over my head, but kudos! :idea:
User avatar
By @xi@g@me
#95483 Looks like I'm more familiar with tensilica ASM than with x86 now '^^
Anyways, thanks for the kudos :-)

This way, I managed to generate a clock signal @ 6.66Mhz, could not do faster. It seems like the ESP8266 is not able to switch pins faster, it needs 6 clock cycles. If you add 6 nops between 2 pin switches, I have the exact same frequency. I may post here when I'll have more research info to share.
User avatar
By eriksl
#95717 Yes you already found out. You can't execute code from DRAM. There is no "general purpose" RAM like on x86. There are only two places that can contain code to be executed and that's FLASH and IRAM. As code from flash is always read into IRAM first ("cached") it's actually one.

The IRAM is divided into two parts: half of it is "cache" for SPI FLASH code, the other half is "IRAM" ram where you can have code of yourself and keep it there. I guess you can instruct the assembler to reserve an x amount of bytes there (instead of real code), then you could put some code there runtime. I think it's obvious not to use the "flash cache" area.
User avatar
By eriksl
#95718 About the pin change frequency, yes that is correct. The I/O's are connected over an internal bus (the APB, advanced peripheral bus) which is only that fast. If you need a steady and fast frequency, I would not recommend using an ESP8266 anyway, it's not designed for that purpose. I'd think of a VCO (voltage controlled oscillator) or (I2C/SPI) programmable oscillator. You also might want to consider the UART which can output data at 80 Mhz (divider = 1) or the I2S module which can also be very fast. Advantages: less work in software, higher speeds and completely PLL controlled so deviations in cycles by non-maskable-interrupts.

Or use an ESP32 which has some interesting hardware modules which will very probably do what you want anyway (the bit pattern generator).