These are chat archives for SmingHub/Sming

14th
Nov 2015
alon24
@alon24
Nov 14 2015 08:09
how do i use pwm in sming if I want to drive 2 motors at a freq and duty cycle, I do do not undrstand the example, anyone can hel;p?
crosofg
@crosofg
Nov 14 2015 09:26
@alon24 define pins you want to use
This message was deleted
This message was deleted
This message was deleted
This message was deleted
//PWM
uint8_t pins[4] =
{ 12, 15, 13, 5 }; // List of pins that you want to connect to pwm
HardwarePWM Esp_pwm(pins, 4);
Esp_pwm.setPeriod(PERIOD);
Esp_pwm.setDuty(pin, duty);
robotiko
@robotiko
Nov 14 2015 10:49
@crosofg what are teh valid frecuencies accepted by t esp pwm?
range
crosofg
@crosofg
Nov 14 2015 11:33
@robotiko I am not sure about the valid ranges. However it seems to work at 10hz as well. Both duty and period are related max_duty=period*1000/45
alon24
@alon24
Nov 14 2015 12:06
@crosofg I want 2 pins to be pwm, and set their duty separately, do I need 2 hardware pwm instances?
also does period mean that I set a timer to change it or reset it every so often?
crosofg
@crosofg
Nov 14 2015 12:21
@alon24 no.period is the duration of the pwm duty in microseconds. For example, for 1kh the length of full duty is 1ms or 1000 us. so period is 1000.
i dont think two separate instances are required.
alon24
@alon24
Nov 14 2015 12:25
so if if I want to change speed I change duty, for each pin at a time so 0 is stop?
crosofg
@crosofg
Nov 14 2015 12:26
yes.
alon24
@alon24
Nov 14 2015 12:27
is 1000 a good period. I mean how do I know, I have regular motor for the smartcar
what is driver pwm, in basic pwm example
Dmitry Kireev
@kireevco
Nov 14 2015 13:32
@crosofg how do I set frequency with pwm?
let’s say I want to connect a speaker
crosofg
@crosofg
Nov 14 2015 18:08
@alon24 Driver pwm implements software PWM, uses timer to set duty.
alon24
@alon24
Nov 14 2015 18:09
which should I use
crosofg
@crosofg
Nov 14 2015 18:09
Hardware PWM,
its accurate
David
@dmarkey
Nov 14 2015 18:10
Have we solved any of the hwtimer and hwpwm myteries?
alon24
@alon24
Nov 14 2015 18:10
would that take away timers or interrupts? what's the tradeoff for using hardware pwm
crosofg
@crosofg
Nov 14 2015 18:10
@kireevco Shouldnt the sound output for a speaker be generated using sine waves?
@alon24 @dmarkey hwpwm uses hwtimer by defualt i think
David
@dmarkey
Nov 14 2015 18:11
yes I know.. and it's borked on Sming
alon24
@alon24
Nov 14 2015 18:12
I remember there was talk about only one timer, so when u use hw pwm, what do I loose
also can I run hardware pwm in any gpios
crosofg
@crosofg
Nov 14 2015 18:17
@alon24 its is working for me
on all the pis
David
@dmarkey
Nov 14 2015 18:56
@crosofg where did you get that HW pwm class
alonewolfx2
@alonewolfx2
Nov 14 2015 19:02
@crosofg where did you get that HW pwm class
good question
crosofg
@crosofg
Nov 14 2015 19:03
from hrsavla and raburton
they have written some code for hwpwm
alonewolfx2
@alonewolfx2
Nov 14 2015 19:05
its in develop or master?
crosofg
@crosofg
Nov 14 2015 19:06
neither .. its under feature
alonewolfx2
@alonewolfx2
Nov 14 2015 19:07
there is no feature branch right now in sming repo :)
crosofg
@crosofg
Nov 14 2015 19:08
i meant in hrsasvla's sming repo
hreintke
@hreintke
Nov 14 2015 19:25
hwpwm is already merged into develop
David
@dmarkey
Nov 14 2015 19:26
is it working correctly?
hreintke
@hreintke
Nov 14 2015 19:29
There are different opinions about that. From some I see messages OK, especially from @raburton : No.
In the hw timer discussion (which is related because hwpwm uses hwtimer) there is an idea that it might be sdk related -> not confirmed
alonewolfx2
@alonewolfx2
Nov 14 2015 19:47
@hreintke can you guide me. i want to try hwpwm with irf530
alonewolfx2
@alonewolfx2
Nov 14 2015 20:27
make rebuild 
C+ app/application.cpp
app/application.cpp:17:25: fatal error: HardwarePWM.h: No such file or directory
 #include <HardwarePWM.h>
                         ^
compilation terminated.
make: *** [out/build/app/application.o] Error 1
alonewolfx2
@alonewolfx2
Nov 14 2015 20:35
or if i copy hardwarepwm.h into the include in basic_hwpwm i am getting
22:33:33 **** Build of configuration Sming for project Basic_HwPWM ****
make rebuild 
C+ app/application.cpp
In file included from c:/tools/Sming/Sming/SmingCore/SmingCore.h:24:0,
                 from app/application.cpp:16:
c:/tools/Sming/Sming/SmingCore/PWM.h:61:18: error: previous declaration of 'DriverPWM EspPWM' with 'C++' linkage
 extern DriverPWM EspPWM;
                  ^
In file included from include/HardwarePWM.h:25:0,
                 from app/application.cpp:17:
c:/tools/Sming/Sming/SmingCore/pwm.h:61:18: error: conflicts with new declaration with 'C' linkage
 extern DriverPWM EspPWM;
                  ^
In file included from c:/tools/Sming/Sming/SmingCore/SmingCore.h:24:0,
                 from app/application.cpp:16:
c:/tools/Sming/Sming/SmingCore/PWM.h:64:6: error: previous declaration of 'void analogWrite(uint8_t, int)' with 'C++' linkage
 void analogWrite(uint8_t pin, int duty);
      ^
In file included from include/HardwarePWM.h:25:0,
                 from app/application.cpp:17:
c:/tools/Sming/Sming/SmingCore/pwm.h:64:39: error: conflicts with new declaration with 'C' linkage
 void analogWrite(uint8_t pin, int duty);
                                       ^
In file included from c:/tools/Sming/Sming/SmingCore/SmingCore.h:24:0,
                 from app/application.cpp:16:
c:/tools/Sming/Sming/SmingCore/PWM.h:65:6: error: previous declaration of 'void noAnalogWrite(uint8_t)' with 'C++' linkage
 void noAnalogWrite(uint8_t pin);
      ^
In file included from include/HardwarePWM.h:25:0,
                 from app/application.cpp:17:
c:/tools/Sming/Sming/SmingCore/pwm.h:65:31: error: conflicts with new declaration with 'C' linkage
 void noAnalogWrite(uint8_t pin);
                               ^
In file included from c:/tools/Sming/Sming/SmingCore/SmingCore.h:24:0,
                 from app/application.cpp:16:
c:/tools/Sming/Sming/SmingCore/PWM.h:67:10: error: previous declaration of 'uint16_t analogRead(uint16_t)' with 'C++' linkage
 uint16_t analogRead(uint16_t pin);
          ^
In file included from include/HardwarePWM.h:25:0,
                 from app/application.cpp:17:
c:/tools/Sming/Sming/SmingCore/pwm.h:67:33: error: conflicts with new declaration with 'C' linkage
 uint16_t analogRead(uint16_t pin);
                                 ^
In file included from app/application.cpp:17:0:
include/HardwarePWM.h:47:17: error: 'PWM_CHANNEL_NUM_MAX' was not declared in this scope
  uint8 channels[PWM_CHANNEL_NUM_MAX];
                 ^
make: *** [out/build/app/application.o] Error 1

22:33:33 Build Finished (took 494ms)
alonewolfx2
@alonewolfx2
Nov 14 2015 21:12
ok its solved but it seems develop branch cant compiling on windows.
hreintke
@hreintke
Nov 14 2015 22:07
@alonewolfx2 :
What did you need to change to get it compiling on windows ?
robotiko
@robotiko
Nov 14 2015 22:08
it is compiling in my win7 32b
alonewolfx2
@alonewolfx2
Nov 14 2015 22:09
i copied hardwarepwm.h into the include and re-compile smingframework
but it still have error on windows 10 x 4
# Generating image...
c:/Espressif/utils/esptool.exe
Traceback (most recent call last):
  File "esptool.py", line 666, in <module>
  File "esptool.py", line 429, in get_symbol_addr
  File "esptool.py", line 426, in _fetch_symbols
ValueError: invalid literal for int() with base 16: 'U'
make: *** [out/build/app.out] Error 255
error message come with develop branch
hreintke
@hreintke
Nov 14 2015 22:17
It is compiling with me on win7 64 bits
I've seen multiple issues last week(s) with esptool #402 / #395
robotiko
@robotiko
Nov 14 2015 22:19
can it be related to pyhton version ?
alonewolfx2
@alonewolfx2
Nov 14 2015 22:19
i dont have phyton
hreintke
@hreintke
Nov 14 2015 22:19
I am running esptool.exe
alonewolfx2
@alonewolfx2
Nov 14 2015 22:19
me too
robotiko
@robotiko
Nov 14 2015 22:20
me too
but
File "esptool.py", line 666, in <module>
sounds.. weird
alonewolfx2
@alonewolfx2
Nov 14 2015 22:21
ok i am trying to download phyton but old branch working. i think weird part is this
hreintke
@hreintke
Nov 14 2015 22:21
I changed in makefile-windows-mk esptool.exe to
ESPTOOL ?= $(SDK_TOOLS)/esptool.py
and it still compiles
what is the "date" of your \espressif\utils\esptool.py
and have python 2.7.9 on my windows system
alonewolfx2
@alonewolfx2
Nov 14 2015 22:25
10.06.2015. yours?
hreintke
@hreintke
Nov 14 2015 22:26
22-7-15
alonewolfx2
@alonewolfx2
Nov 14 2015 22:26
can you send it?
hreintke
@hreintke
Nov 14 2015 22:26
from udk 2.0.8
alonewolfx2
@alonewolfx2
Nov 14 2015 22:27
i have 206 prpably.
robotiko
@robotiko
Nov 14 2015 22:27
@alonewolfx2 you are on sdk 1.40, right?
alonewolfx2
@alonewolfx2
Nov 14 2015 22:27
exe please
yes
robotiko
@robotiko
Nov 14 2015 22:28
@hreintke you are in sdk 1.3. right?
I'm in 1.3
206 updated manually to 1.3.0
hreintke
@hreintke
Nov 14 2015 22:28
yes I am but i can try 1.4.0, give me 5 min's
alonewolfx2
@alonewolfx2
Nov 14 2015 22:30
@hreintke its solved
seems esptool issue
hreintke
@hreintke
Nov 14 2015 22:30
ok
That is a tricky one.
robotiko
@robotiko
Nov 14 2015 22:31
but
it doesnt make too much sense.. that if you revert smign version.. it works,right?
alonewolfx2
@alonewolfx2
Nov 14 2015 22:32
yes
robotiko
@robotiko
Nov 14 2015 22:32
brrbbr
still think is just environment
alonewolfx2
@alonewolfx2
Nov 14 2015 22:33
i am not sure
@robotiko what is your esptool date?
hreintke
@hreintke
Nov 14 2015 22:34
for the issues I mentioned I was searching internet and came to this :
themadinventor/esptool#43
there is a discussion on esptool.py which needed update
robotiko
@robotiko
Nov 14 2015 22:35
10/0/2015
06
same as yours
hreintke
@hreintke
Nov 14 2015 22:36
but I agree with @robotiko that reverting sming version is strange
robotiko
@robotiko
Nov 14 2015 22:36
in case you want to try
hreintke
@hreintke
Nov 14 2015 22:37
@robotiko which udk are you on ?
robotiko
@robotiko
Nov 14 2015 22:37
206
alonewolfx2
@alonewolfx2
Nov 14 2015 22:37
@robotiko same issue with yours
robotiko
@robotiko
Nov 14 2015 22:37
puff
it works for me
alonewolfx2
@alonewolfx2
Nov 14 2015 22:38
really?
robotiko
@robotiko
Nov 14 2015 22:38
just checkedout develop and rebuild
all ok
alonewolfx2
@alonewolfx2
Nov 14 2015 22:41
you have win32
hreintke
@hreintke
Nov 14 2015 22:41
I have win64
alonewolfx2
@alonewolfx2
Nov 14 2015 22:41
me too
soo problem on win64
hreintke
@hreintke
Nov 14 2015 22:43
must be : i changed back to udk 206 and have compile issue
alonewolfx2
@alonewolfx2
Nov 14 2015 22:43
same ?
hreintke
@hreintke
Nov 14 2015 22:43
# Generating image...
Traceback (most recent call last):
  File "c:/espressif/utils/esptool.py", line 666, in <module>
    image.entrypoint = e.get_symbol_addr(args.entry_symbol)
  File "c:/espressif/utils/esptool.py", line 429, in get_symbol_addr
    self._fetch_symbols()
  File "c:/espressif/utils/esptool.py", line 426, in _fetch_symbols
    self.symbols[fields[2]] = int(fields[0], 16)
ValueError: invalid literal for int() with base 16: 'U'
make: *** [out/build/app.out] Error 1
alonewolfx2
@alonewolfx2
Nov 14 2015 22:43
yes
robotiko
@robotiko
Nov 14 2015 22:45
yup same
so the issue is udk + win64 +new sming?
hreintke
@hreintke
Nov 14 2015 22:49
seems to be but I can't really think of a reason
robotiko
@robotiko
Nov 14 2015 22:49
makes no sense
hreintke
@hreintke
Nov 14 2015 22:53
will update the issues tomorrow to check whether that also solves those
but agree makes no sense
I am out now, talk later. Have fun with your esp projects
robotiko
@robotiko
Nov 14 2015 22:55
have fun in the outer world @hreintke
:D