Chat freely about anything...

User avatar
By gamecompiler
#52243 First, thank your very much for the code!

Adding system_timer_reinit (); to extern "C" void user_init(void) doesnt work...
I hear sound (more bad than the sketch before), but your debugging code says that my timer is not working with microseconds:

49025314 Pos 64541 Size 161407
Code: Select all49525536 Pos 68508 Size 161407
50025717 Pos 72437 Size 161407
50525964 Pos 76370 Size 161407
51026197 Pos 80312 Size 161407
51526409 Pos 84258 Size 161407


Please help me Oo


Thanks in advance,
gamecompiler.
User avatar
By kirchnet
#52468 You need to change one of the system files.

In order to activate the microsecond timer, as others have noted in other posts on this forum, you need to call system_timer_reinit (); in the function user_init(void) {} which is located in the file core_esp8266_main.cpp in the cores directory. On my Windows installation of the Arduino IDE 1.6.9 this file is located in this path: C:\Users\[UserName]\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266 This change will set the timer from milliseconds to microseconds. - See more at: viewtopic.php?f=6&t=8562#sthash.oXrmngNI.dpuf

If you have done that and it sill is in milliseconds then it's beyond my knowledge.
User avatar
By Geert
#55777 Hey, I tried to make this work, I changed the core_esp8266_main.cpp file and ran the program without the debugging mode, but it sounds really strange (some ticks instead of the sound).

I exported the sound from Audacity, with 8000Hz and 8 bit unsigned raw.

These are the values I get when turning on the debugging mode:

Code: Select alltimer started
69570391 Pos 930 Size 9548
70070581 Pos 4931 Size 9548
70570926 Pos 8934 Size 9548
timer disarmed
file opened
File size 9548
timer started
71071181 Pos 3080 Size 9548
71571441 Pos 7084 Size 9548
timer disarmed
file opened
File size 9548
timer started
72071715 Pos 1253 Size 9548
72571979 Pos 5253 Size 9548
73072278 Pos 9256 Size 9548
timer disarmed
file opened
File size 9548
timer started
73572589 Pos 3451 Size 9548
74072828 Pos 7454 Size 9548
timer disarmed
file opened
File size 9548
timer started
74573082 Pos 1748 Size 9548
75073356 Pos 5750 Size 9548
timer disarmed
file opened
File size 9548
timer started
75573726 Pos 0 Size 9548
76084619 Pos 4001 Size 9548
76584869 Pos 8006 Size 9548
timer disarmed
file opened
File size 9548
timer started
77085492 Pos 2172 Size 9548
77586017 Pos 6169 Size 9548


Does this mean that my times is just twice as slow?, because the difference between the numbers is 4000 instead of the 2250 that you have.

If you would be able to put a zip file online with the sound file and the code that would be awesome... (than I know at least it is not the audio file that is bugging me. I added the audio file as attachment...
Attachments
it had a raw extension, you're not able to play it with media player, because it doesn't contain the headers...
(5.25 KiB) Downloaded 267 times