Thanks Don for the suggestions.

 I tried different flavours:
1- relative delays: start after (what I believe to be) late services
After=syslog.target network.target


2- absolute delays:
ExecStartPre=/bin/sleep 60
TimeoutSec=100s


3- including large delays inside C before reaching the device trees.

None worked. It's like it is not linked to the timing...
Could some access grant stuff be defined at the time the service is 
scheduled, rather than at the time the service actually starts ?

Or is my C code not adequate ?
    fd_len = snprintf(buf, sizeof(buf), "%s/period", 
"/sys/devices/ocp.3/pwm_test_P9_14.16");
    fd = open(buf, O_WRONLY);
    if (fd < 0) {
        perror("pwm/period");
        printf("pwm/period, %s", buf);
        return fd;
    }



Additional help would be much appreciated :-)


Le mercredi 9 juillet 2014 13:09:07 UTC+2, BubbleBone a écrit :
>
> Hi,
>
> I am having trouble with configuring my PWM at start-up. 
> A C progam b1, which include the setup of the PWMs, is called at start-up 
> by a System Service. 
> The cape get well installed. But the periods, duty cycles and polarity 
> won't be set correctly. 
> - If I restart the service afterwards, it works !
> - I tried adding awfully long delays inside the c program (like 30 
> seconds), thinking that maybe the device tree was not yet set fully. But 
> still, it doesn't work.
>
> My debug imagination reachs its limits. Any idea, suggestion would be much 
> appreciated :-)
>  
> Here are the details:
> BeagleBoard.org BeagleBone Debian Image 2014-05-14
> Rev board: A6A
>
> slots details:
>
> 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
>  5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
>  7: ff:P-O-L Override Board Name,00A0,Override Manuf,GPIO-Cape
>  8: ff:P-O-L Override Board Name,00A0,Override Manuf,am33xx_pwm
>  9: ff:P-O-L Override Board Name,00A0,Override Manuf,bone_pwm_P9_14
> 10: ff:P-O-L Override Board Name,00A0,Override Manuf,bone_pwm_P9_22
> 11: ff:P-O-L Override Board Name,00A0,Override Manuf,bone_pwm_P8_13
>
> ___________________________________
>
> System service when it is *NOT WORKING *(i.e. at boot):
>
> root@beaglebone:~# systemctl status b1.service
> b1.service - B1 SW
>           Loaded: loaded (/lib/systemd/system/b1.service; enabled)
>           Active: active (running) since Sat, 01 Jan 2000 00:00:08 +0000; 
> 14 years and 4 months ago
>         Main PID: 595 (b2)
>           CGroup: name=systemd:/system/b1.service
>                   └ 595 /root/b2
>
> May 15 02:19:29 beaglebone b1[595]: pwm/polarity: No such file or di...y
> May 15 02:19:29 beaglebone b1[595]: pwm/period: No such file or directory
> May 15 02:19:29 beaglebone b1[595]: pwm/duty: No such file or directory
> ...
>
>
> duty contents (the path exist at the time of the read but have the 
> defaults values) :
> cat /sys/devices/ocp.3/pwm_test_P*/duty
> 0
> 0
> 0
>
> ________________________________________
>
> System service after a *restart* (*WORKING*):
>
> root@beaglebone:~# systemctl restart b1.service
> root@beaglebone:~# systemctl status b1.service
> b1.service - B1 SW
>           Loaded: loaded (/lib/systemd/system/b1.service; enabled)
>           Active: active (running) since Thu, 15 May 2014 02:20:49 +0000; 
> 37s ago
>         Main PID: 1215 (b2)
>           CGroup: name=systemd:/system/b1.service
>                   └ 1215 /root/b2
>
> duty contents (ok)
> root@beaglebone:~# cat /sys/devices/ocp.3/pwm_test_P*/duty
> 1600000
> 1600000
> 1000000
>
>
> Note also that I have observed occasionally cases where 1 or 2 PWM were 
> set correctly. But never all of them. And I don't have traces of thoses. 
>
> System service description:
> [Unit]
> Description=B1 SW
>
> [Service]
> WorkingDirectory=/root/
> ExecStart=/root/b2
> SyslogIdentifier=b1
>
> [Install]
> WantedBy=multi-user.target
>
>
> Again, any clue would be much appreciated :-)
> Let me know if you need more details.
>
> Have a good day !
>
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to