Search found 6 matches

by nameofuser1
Mon Mar 04, 2019 10:26 am
Forum: ESP-IDF
Topic: How to add code generation target?
Replies: 1
Views: 3899

How to add code generation target?

I need to generate header files at compile time. As https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html#makefile-componentbuild claims it can be done using Makefile.componentbuild file. However there are no examples and I can not find any in the web. I have tried to us...
by nameofuser1
Wed Dec 12, 2018 12:08 pm
Forum: ESP-IDF
Topic: Critical sections explanation
Replies: 5
Views: 12554

Critical sections explanation

I wonder what the portMUX_INITIALIZER_UNLOCKED value actually means? I understand that spinlocks are used in order to synchronize cores when they need access to shared resource but should I always use portMUX_INITIALIZER_UNLOCKED when locking resource or I can set my own owner field in that structur...
by nameofuser1
Wed Dec 12, 2018 11:32 am
Forum: ESP-IDF
Topic: Memory allocation thread and interrupt safety
Replies: 3
Views: 5104

Re: Memory allocation thread and interrupt safety

They are threadsafe, but I would not assume they are interrupt-safe. I'm not sure why you would do a malloc in an ISR anyway, and even if it worked it does not sound like a good idea;l what's your use case there? Thanks for your reply! I allocate small event structures in order to avoid having huge...
by nameofuser1
Tue Dec 11, 2018 10:56 pm
Forum: Hardware
Topic: I2S DAC generate tone
Replies: 2
Views: 8854

Re: I2S DAC generate tone

1. The I2S needs 16-bit samples, you're stashing (repeated) 8-bit samples into it. 2. The I2S reads the samples as 32-bit words and outputs the high 16-bit first and the low 16-bit second. This means that if you want to send it 16-bit samples, you'll need to swap the even and odd 16-bit words. 3. T...
by nameofuser1
Tue Dec 11, 2018 10:54 pm
Forum: ESP-IDF
Topic: Memory allocation thread and interrupt safety
Replies: 3
Views: 5104

Memory allocation thread and interrupt safety

Hi there! Could anyone clarify for me please whether malloc/new are thread and interrupt safe? I can see that there is an implementation of _malloc_r in newlib directory which is considered to be thread safe. But what about common malloc? Regarding to the documentation it seems that malloc and _mall...
by nameofuser1
Wed Nov 28, 2018 10:04 am
Forum: Hardware
Topic: I2S DAC generate tone
Replies: 2
Views: 8854

I2S DAC generate tone

I am trying to produce sine wave with I2S. There are several strange things I have found I don't know how to overcome. Here is my code: #include <Arduino.h> #include <driver/i2s.h> #include <driver/dac.h> /* I2S DAC */ #define DAC_CHANNEL DAC_CHANNEL_1 // GPIO25 channel #define I2S_DAC I2S_NUM_0 #de...