libpruio (BB D/A - I/O fast and easy)

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
Post Reply
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

Dinosaur wrote:On your colour chart you show P9-14,16,21,22 & 42 as Multi Feature Digital, which I assumed means they are attached to a PRU.
However, neither one is shown on the mode charts as PRU.
'Multi' isn't related to PRU GPIO. It means more then normal GPIO, from the libpruio point of view. Ie. the pins can also get used for PWM, CAP, QEP, TIMER. Features like I2C, SPI or MMC do not count as 'multi', since these features cannot get controlled by libpruio.
Dinosaur wrote:So far the only pins free and available I have found assigned to PRU0
P8-11,12,15 & 16
P9-24,25,27 & 30.
I cannot check them ATM, but it looks reasonable. And when you don't use the uSD slot, you can have further six pins at the card slot.

Regards
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: libpruio (BB D/A - I/O fast and easy)

Post by Dinosaur »

Hi TJF

Taking my time designing the board.
I have assigned 20 O/P's and 8 I/P

Was contemplating putting jumpers on each O/P & I/P so that the connection to the BBB could be broken
by removing the jumper. But the amount of drill holes on the C/Brd goes through the roof.

The cape won't have any rom on board, so at power up the BBB will have connections that are not identified
until the program starts.

Do you see a problem with that ?
I seem to recall the I/O is tri-state at power up and thus does no damage.

Regards
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

Hi Dinosaur!
Dinosaur wrote:Taking my time designing the board.
I have assigned 20 O/P's and 8 I/P

Was contemplating putting jumpers on each O/P & I/P so that the connection to the BBB could be broken
by removing the jumper. But the amount of drill holes on the C/Brd goes through the roof.
Sounds good for prototyping. But on a production board ...?
Dinosaur wrote:The cape won't have any rom on board, so at power up the BBB will have connections that are not identified
until the program starts.

Do you see a problem with that ?
I seem to recall the I/O is tri-state at power up and thus does no damage.
No, they're not tri-state. Check their state by running the example analyse.bas after start up. In first output section 'Header pins:' you'll find the pinmux modes. Output pins are zero, but input pins with pull-up resistor will have 3V3 at start-up. Test the boot process with your bread board!

In order to change a mode, you'll have to implement a device tree blob loaded by uBoot. Try to avoid that, since it's additional installation effort (= a possible failure source).

Regards
tai
Posts: 2
Joined: Mar 14, 2019 22:50

Re: libpruio (BB D/A - I/O fast and easy)

Post by tai »

Hello,

I've been working on a small proof of concept wireless measuring device. I started using libpruio on the BeagleBone Black and have it working great on that device, but can't seem to get it working on the wireless model. Looking around this forum and google groups, I don't think I've seen anyone mention the wireless model, is it supported?

Here's a bit more info:
Running the latest debian image from beagleboard.org.

Code: Select all

debian@beaglebone:~$ lsmod | grep uio
uio_pdrv_genirq        16384  0
libpruio               16384  0
uio_pruss              16384  0
uio                    20480  2 uio_pruss,uio_pdrv_genirq
Here's the uEnv.txt file:

Code: Select all

###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1

###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
#uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
#uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
#uboot_overlay_addr3=/lib/firmware/<file3>.dtbo
###
###Additional custom capes
#uboot_overlay_addr4=/lib/firmware/<file4>.dtbo
#uboot_overlay_addr5=/lib/firmware/<file5>.dtbo
#uboot_overlay_addr6=/lib/firmware/<file6>.dtbo
#uboot_overlay_addr7=/lib/firmware/<file7>.dtbo

###
###Custom Cape
#dtb_overlay=/lib/firmware/<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
disable_uboot_overlay_emmc=1
disable_uboot_overlay_video=1
disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
disable_uboot_overlay_adc=1

###
###PRUSS OPTIONS
###pru_rproc (4.4.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-4-TI-00A0.dtbo
###pru_rproc (4.14.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_uio (4.4.x-ti, 4.14.x-ti & mainline/bone kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo

###
###Cape Universal Enable
#enable_uboot_cape_universal=1

There are no devices listed from

Code: Select all

 ls -a /dev/ | grep uio 


Thanks,
Tai
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

Hi Tai! Welcome to the forum.

I've no BBB wireless, so I cannot test. But since libpruio is a hardware driver for the AM335x CPU, it should run on any board using this processor.

You don't have a libpruio issue. Instead there's a problem with the uio_pruss driver, so it's a LINUX - perhaps uBoot - issue.

This kernel driver loads, but it doesn't create the interrupt devices /dev/uio*. Usually that happens when the rproc driver is loaded in parallel (check output of command lsmod). You may find some hints in the output from dmesg.

The latest images have a line 'uname_r=...' at the top of file /boot/uEnv.txt, so your version seems to be old. For further hints I need to know which kernel version you installed (uname -r).

Regards
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: libpruio (BB D/A - I/O fast and easy)

Post by Dinosaur »

Hi TJF

Finished the board design and just to double check that all the Inputs and Outputs will
be available, I wrote a quick test and connected 4 led's on P8,7 8 9 and 10.

Turning the led's On works as expected, but turning them Off by pressing 9, only turns 7 & 8 off
and then hangs the program.

What am I doing wrong here ?

Code: Select all

#INCLUDE ONCE "BBB/pruio.bi"
#INCLUDE ONCE "BBB/pruio_pins.bi"

'Define pin Nbr's used on P8 for O/P's
#DEFINE P0 P8_07 
#DEFINE P1 P8_08 
#Define P2 P8_09
#DEFINE P3 P8_10
#DEFINE P4 P8_13
#DEFINE P5 P8_14
#Define P6 P8_15
#DEFINE P7 P8_16
#DEFINE P8 P8_17
#DEFINE P9 P8_18 
'Define pin Nbr's used on P9 for O/P's
#DEFINE P10 P9_12
#DEFINE P11 P9_13 
#Define P12 P9_14
#DEFINE P13 P9_16
#DEFINE P14 P9_17
#DEFINE P15 P9_18
#DEFINE P16 P9_21
#DEFINE P17 P9_23
#DEFINE P18 P9_24
#DEFINE P19 P9_41
'DEfine pin Nbr's used for I/P's
#DEFINE P20 P8_11
#DEFINE P21 P8_12
#DEFINE P22 P8_26
#DEFINE P23 P9_11 
#DEFINE P24 P9_15
#DEFINE P25 P9_22
#DEFINE P26 P9_27
#DEFINE P27 P9_30


	VAR io = NEW PruIo '*< Create a PruIo structure, wakeup subsystems.
	WITH *io
		IF .Gpio->config(P0 , PRUIO_GPIO_OUT0) THEN ?"failed setting P0 (" & *.Errr & ")"
		IF .Gpio->config(P1 , PRUIO_GPIO_OUT0) THEN ?"failed setting P1 (" & *.Errr & ")"
		IF .Gpio->config(P2 , PRUIO_GPIO_OUT0) THEN ?"failed setting P2 (" & *.Errr & ")"
		IF .Gpio->config(P3 , PRUIO_GPIO_OUT0) THEN ?"failed setting P3 (" & *.Errr & ")"
		IF .Gpio->config(P4 , PRUIO_GPIO_OUT0) THEN ?"failed setting P4 (" & *.Errr & ")"
		IF .Gpio->config(P5 , PRUIO_GPIO_OUT0) THEN ?"failed setting P5 (" & *.Errr & ")"
		IF .Gpio->config(P6 , PRUIO_GPIO_OUT0) THEN ?"failed setting P6 (" & *.Errr & ")"
		IF .Gpio->config(P7 , PRUIO_GPIO_OUT0) THEN ?"failed setting P7 (" & *.Errr & ")"
		IF .Gpio->config(P8 , PRUIO_GPIO_OUT0) THEN ?"failed setting P8 (" & *.Errr & ")"
		IF .Gpio->config(P9 , PRUIO_GPIO_OUT0) THEN ?"failed setting P9 (" & *.Errr & ")"
		IF .Gpio->config(P10, PRUIO_GPIO_OUT0) THEN ?"failed setting P10 (" & *.Errr & ")"
		IF .Gpio->config(P11, PRUIO_GPIO_OUT0) THEN ?"failed setting P11 (" & *.Errr & ")"
		IF .Gpio->config(P12, PRUIO_GPIO_OUT0) THEN ?"failed setting P12 (" & *.Errr & ")"
		IF .Gpio->config(P13, PRUIO_GPIO_OUT0) THEN ?"failed setting P13 (" & *.Errr & ")"
		IF .Gpio->config(P14, PRUIO_GPIO_OUT0) THEN ?"failed setting P14 (" & *.Errr & ")"
		IF .Gpio->config(P15, PRUIO_GPIO_OUT0) THEN ?"failed setting P15 (" & *.Errr & ")"
		IF .Gpio->config(P16, PRUIO_GPIO_OUT0) THEN ?"failed setting P16 (" & *.Errr & ")"
		IF .Gpio->config(P17, PRUIO_GPIO_OUT0) THEN ?"failed setting P17 (" & *.Errr & ")"
		IF .Gpio->config(P18, PRUIO_GPIO_OUT0) THEN ?"failed setting P18 (" & *.Errr & ")"
		IF .Gpio->config(P19, PRUIO_GPIO_OUT0) THEN ?"failed setting P19 (" & *.Errr & ")"
		IF .config() THEN ?"config failed (" & *.Errr & ")" : End
	End With

	WITH *io
		IF .Gpio->config(P20, PRUIO_GPIO_IN_1) THEN ?"failed setting P20 (" & *.Errr & ")"
		IF .Gpio->config(P21, PRUIO_GPIO_IN_1) THEN ?"failed setting P21 (" & *.Errr & ")"
		IF .Gpio->config(P22, PRUIO_GPIO_IN_1) THEN ?"failed setting P22 (" & *.Errr & ")"
		IF .Gpio->config(P23, PRUIO_GPIO_IN_1) THEN ?"failed setting P23 (" & *.Errr & ")"
		IF .Gpio->config(P24, PRUIO_GPIO_IN_1) THEN ?"failed setting P24 (" & *.Errr & ")"
		IF .Gpio->config(P25, PRUIO_GPIO_IN_1) THEN ?"failed setting P25 (" & *.Errr & ")"
		IF .Gpio->config(P26, PRUIO_GPIO_IN_1) THEN ?"failed setting P26 (" & *.Errr & ")"
		IF .Gpio->config(P27, PRUIO_GPIO_IN_1) THEN ?"failed setting P27 (" & *.Errr & ")"
		IF .config() THEN ?"config failed (" & *.Errr & ")" : End
	End With

	WITH *io
		Do
			IF .Errr THEN EXIT DO
			VAR k  = Asc(INKEY())
			Select Case AS CONST k
				Case Asc("0")
					.Gpio->setValue(P0, 1)
				Case Asc("1")
					.Gpio->setValue(P1, 1)
				Case Asc("2")
					.Gpio->setValue(P2, 1)
				Case Asc("3")
					.Gpio->setValue(P3, 1)
				Case Asc("9")
					.Gpio->setValue(P0, 0)
					.Gpio->setValue(P1, 0)
					.Gpio->setValue(P2, 0)
					.Gpio->setValue(P3, 0)
					Exit Do
			End Select
		Loop
	End With
End
REgards

EDIT: Putting a "Sleep 1" between each .Gpio->setValue(P0, 0) in Case 9 fixes it.
That is disappointing. What would be the minimum delay between these statements ?
I know there are other statements I can use to turn multiple O/P's off.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

Hi Dinosaur!

I can reproduce the problem here. It doesn't occur always. The more outputs are high, the bigger is the risk of hanging.
Dinosaur wrote:EDIT: Putting a "Sleep 1" between each .Gpio->setValue(P0, 0) in Case 9 fixes it.
Every code slowing down the executation speed seems to fix it. Ie. the print commands in this code

Code: Select all

#INCLUDE ONCE "BBB/pruio.bi"
#INCLUDE ONCE "BBB/pruio_pins.bi"

'Define pin Nbr's used on P8 for O/P's
#DEFINE P0 P8_07
#DEFINE P1 P8_08
#Define P2 P8_09
#DEFINE P3 P8_10
#DEFINE P4 P8_13
#DEFINE P5 P8_14
#Define P6 P8_15
#DEFINE P7 P8_16
#DEFINE P8 P8_17
#DEFINE P9 P8_18
'Define pin Nbr's used on P9 for O/P's
#DEFINE P10 P9_12
#DEFINE P11 P9_13
#Define P12 P9_14
#DEFINE P13 P9_16
#DEFINE P14 P9_17
#DEFINE P15 P9_18
#DEFINE P16 P9_21
#DEFINE P17 P9_23
#DEFINE P18 P9_24
#DEFINE P19 P9_41
'DEfine pin Nbr's used for I/P's
#DEFINE P20 P8_11
#DEFINE P21 P8_12
#DEFINE P22 P8_26
#DEFINE P23 P9_11
#DEFINE P24 P9_15
#DEFINE P25 P9_22
#DEFINE P26 P9_27
#DEFINE P27 P9_30


   VAR io = NEW PruIo '*< Create a PruIo structure, wakeup subsystems.
   WITH *io
      IF .Gpio->config(P0 , PRUIO_GPIO_OUT0) THEN ?"failed config P0 (" & *.Errr & ")"
      IF .Gpio->config(P1 , PRUIO_GPIO_OUT0) THEN ?"failed config P1 (" & *.Errr & ")"
      IF .Gpio->config(P2 , PRUIO_GPIO_OUT0) THEN ?"failed config P2 (" & *.Errr & ")"
      IF .Gpio->config(P3 , PRUIO_GPIO_OUT0) THEN ?"failed config P3 (" & *.Errr & ")"
      IF .Gpio->config(P4 , PRUIO_GPIO_OUT0) THEN ?"failed config P4 (" & *.Errr & ")"
      IF .Gpio->config(P5 , PRUIO_GPIO_OUT0) THEN ?"failed config P5 (" & *.Errr & ")"
      IF .Gpio->config(P6 , PRUIO_GPIO_OUT0) THEN ?"failed config P6 (" & *.Errr & ")"
      IF .Gpio->config(P7 , PRUIO_GPIO_OUT0) THEN ?"failed config P7 (" & *.Errr & ")"
      IF .Gpio->config(P8 , PRUIO_GPIO_OUT0) THEN ?"failed config P8 (" & *.Errr & ")"
      IF .Gpio->config(P9 , PRUIO_GPIO_OUT0) THEN ?"failed config P9 (" & *.Errr & ")"
      IF .Gpio->config(P10, PRUIO_GPIO_OUT0) THEN ?"failed config P10 (" & *.Errr & ")"
      IF .Gpio->config(P11, PRUIO_GPIO_OUT0) THEN ?"failed config P11 (" & *.Errr & ")"
      IF .Gpio->config(P12, PRUIO_GPIO_OUT0) THEN ?"failed config P12 (" & *.Errr & ")"
      IF .Gpio->config(P13, PRUIO_GPIO_OUT0) THEN ?"failed config P13 (" & *.Errr & ")"
      IF .Gpio->config(P14, PRUIO_GPIO_OUT0) THEN ?"failed config P14 (" & *.Errr & ")"
      IF .Gpio->config(P15, PRUIO_GPIO_OUT0) THEN ?"failed config P15 (" & *.Errr & ")"
      IF .Gpio->config(P16, PRUIO_GPIO_OUT0) THEN ?"failed config P16 (" & *.Errr & ")"
      IF .Gpio->config(P17, PRUIO_GPIO_OUT0) THEN ?"failed config P17 (" & *.Errr & ")"
      IF .Gpio->config(P18, PRUIO_GPIO_OUT0) THEN ?"failed config P18 (" & *.Errr & ")"
      IF .Gpio->config(P19, PRUIO_GPIO_OUT0) THEN ?"failed config P19 (" & *.Errr & ")"

      IF .Gpio->config(P20, PRUIO_GPIO_IN_1) THEN ?"failed config P20 (" & *.Errr & ")"
      IF .Gpio->config(P21, PRUIO_GPIO_IN_1) THEN ?"failed config P21 (" & *.Errr & ")"
      IF .Gpio->config(P22, PRUIO_GPIO_IN_1) THEN ?"failed config P22 (" & *.Errr & ")"
      IF .Gpio->config(P23, PRUIO_GPIO_IN_1) THEN ?"failed config P23 (" & *.Errr & ")"
      IF .Gpio->config(P24, PRUIO_GPIO_IN_1) THEN ?"failed config P24 (" & *.Errr & ")"
      IF .Gpio->config(P25, PRUIO_GPIO_IN_1) THEN ?"failed config P25 (" & *.Errr & ")"
      IF .Gpio->config(P26, PRUIO_GPIO_IN_1) THEN ?"failed config P26 (" & *.Errr & ")"
      IF .Gpio->config(P27, PRUIO_GPIO_IN_1) THEN ?"failed config P27 (" & *.Errr & ")"

      IF .config() THEN ?"failed config libpruio (" & *.Errr & ")"

      While 0 = .Errr
         VAR k  = Asc(INKEY())
         Select Case AS CONST k
            Case Asc("0")
               if .Gpio->setValue(P0, 1) THEN ?"failed setting P0 (" & *.Errr & ")"
            Case Asc("1")
               if .Gpio->setValue(P1, 1) THEN ?"failed setting P1 (" & *.Errr & ")"
            Case Asc("2")
               if .Gpio->setValue(P2, 1) THEN ?"failed setting P2 (" & *.Errr & ")"
            Case Asc("3")
               if .Gpio->setValue(P3, 1) THEN ?"failed setting P3 (" & *.Errr & ")"
            Case Asc("9")
?3
               if .Gpio->setValue(P3, 0) THEN ?"failed clearing P0 (" & *.Errr & ")"
?2
               if .Gpio->setValue(P2, 1) THEN ?"failed clearing P1 (" & *.Errr & ")" : Exit While
?1
               if .Gpio->setValue(P1, 2) THEN ?"failed clearing P2 (" & *.Errr & ")" : Exit While
?0
               if .Gpio->setValue(P0, 3) THEN ?"failed clearing P3 (" & *.Errr & ")" : Exit While
?"Done"
               Exit While
            Case Else
               If k Then Exit While
               Sleep 10
         End Select
      Wend
   End With
   delete io
It seems to be related to some kind of race conditions. And that's hard to find, since I cannot use print for debugging. I'll have to fix it, but need some time to find the roots. For now, slow down the code, ie. by sleep 1.

Note:
  • Once you allocate memory by calling a constructor, you should always free the memory by calling the destructor:

    Code: Select all

    VAR io = NEW PruIo '*< Create a PruIo structure, wakeup subsystems.
    ...
    Delete io
  • When using command End, FreeBASIC doesn't auto call the destructor!
  • The function io->config() starts the main loop. Call it only once.
Regards
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: libpruio (BB D/A - I/O fast and easy)

Post by Dinosaur »

Hi TJF

Another puzzle
I have simplified the code to minimal (more for my understanding) to create a frequency.
Normally I wouldn't use goto's

Code: Select all

#INCLUDE ONCE "BBB/pruio.bi"
#INCLUDE ONCE "BBB/pruio_pins.bi"

	VAR io = NEW PruIo 
	WITH *io
		IF .Gpio->config(P9_21, PRUIO_GPIO_OUT0) THEN Goto Errer
		IF .config() THEN Goto Errer
		If .Pwm->setValue(P9_21, 200000, 0.5) THEN Goto Errer
		Print "Running"
		Do
		Loop until Inkey = "q"
	End With
	Goto Ending
Errer:
	Print "Errer End"

Ending:
	Print "Shutting Down"
	Delete io
	End
This works only every second time you run it, or if you reset the BBB.
Sleeps don't make any difference.
The times that it doesn't work, the PicoScope shows low voltage high frequency noise (25 Mhz)
It dances around +40 mV about 10mV P2P.


REgards
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

Hi Dinosaur!

Why are you pinmuxing P9_21 first to subsystem GPIOSS-0 (mode 7) and immediately remuxing to PWMSS-0-PwmB (mode 3). While the first mux gets done before the start of the main loop, the remux gets done after the start. You get a race condition here. Sometimes the main loop is running -> PRU faster than ARM, and sometimes not -> ARM faster than PRU.

Note: It's best practice to configure pins before starting the main loop. Avoid unnecessary pinmuxing. When you need to remux a pin then wait until the main loop is up (WHILE io->DRam[0] <> PRUIO_MSG_IO_OK : WEND => I'll make a note on this in the docs).

Here's your code without GOTO and without remuxing

Code: Select all

#INCLUDE ONCE "BBB/pruio.bi"
#INCLUDE ONCE "BBB/pruio_pins.bi"

VAR Errer = "Errer End"
VAR io = NEW PruIo
WITH *io
DO
  IF io->Errr             THEN ?"failed CTOR (" & *.Errr & ")" : EXIT DO
  IF .Pwm->setValue(P9_21, 2., 0.5)               THEN ? Errer : EXIT DO
  IF .config()                                    THEN ? Errer : EXIT DO
  PRINT "Running"
  DO
  LOOP UNTIL INKEY = "q"
  IF .Pwm->setValue(P9_21, 2, 0.0)                THEN ? Errer : EXIT DO
  PRINT "Shutting Down"
LOOP UNTIL 1
END WITH
DELETE io
Regards

PS:
By this example I found out that the DTOR doesn't work as expected (the pin doesn't always go LOW at the end). I'll check it.
tai
Posts: 2
Joined: Mar 14, 2019 22:50

Re: libpruio (BB D/A - I/O fast and easy)

Post by tai »

Hi TJF,

Thanks for the help and the warm welcome! I ommitted some of uEnv.txt earlier, I am using the latest kernel I believe:

Code: Select all

debian@beaglebone:/dev$ uname -r
4.14.71-ti-r80
Full output of lsmod:

Code: Select all

debian@beaglebone:/dev$ lsmod
Module                  Size  Used by
evdev                  24576  1
uio_pdrv_genirq        16384  0
usb_f_mass_storage     53248  2
usb_f_acm              16384  2
u_serial               20480  3 usb_f_acm
usb_f_ecm              20480  2
usb_f_rndis            32768  4
u_ether                20480  2 usb_f_ecm,usb_f_rndis
libcomposite           65536  18 usb_f_ecm,usb_f_acm,usb_f_mass_storage,usb_f_rndis
iptable_nat            16384  0
nf_conntrack_ipv4      20480  1
nf_defrag_ipv4         16384  1 nf_conntrack_ipv4
nf_nat_ipv4            16384  1 iptable_nat
nf_nat                 32768  1 nf_nat_ipv4
nf_conntrack          143360  3 nf_conntrack_ipv4,nf_nat_ipv4,nf_nat
iptable_mangle         16384  0
iptable_filter         16384  0
libpruio               16384  0
uio_pruss              16384  0
uio                    20480  2 uio_pruss,uio_pdrv_genirq
ip_tables              24576  3 iptable_mangle,iptable_filter,iptable_nat
x_tables               36864  3 iptable_mangle,ip_tables,iptable_filter
So rproc isn't loading, I had to rename the

Code: Select all

/etc/modules-load.d/robotcontrol_modules.conf
file as it was loading the rproc module. The only thing I could find regarding rproc or remote process in dmesg are these lines:

Code: Select all

debian@beaglebone:/etc/modules-load.d$ dmesg | grep remoteproc
[    1.212379] remoteproc remoteproc0: wkup_m3 is available
[    1.292234] remoteproc remoteproc0: powering up wkup_m3
[    1.292258] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168
[    1.292525] remoteproc remoteproc0: remote processor wkup_m3 is now up 
Which points to a small processor that handles waking/sleeping and other low power state and transitions from a cursory reading. Let me know if you want the entirety of dmesg output, or if there's any other command output that would help, I'm familiar with LINUX as a desktop/workstation user but I've never gone into such detail with the kernel modules, device trees/overlays, and booting.

Thanks,
Tai
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: libpruio (BB D/A - I/O fast and easy)

Post by Dinosaur »

Hi TJF
Why are you pinmuxing P9_21 first to subsystem GPIOSS-0 (mode 7) and immediately remuxing to PWMSS-0-PwmB (mode 3).
Learning to achieve what I need without becoming expert at it.

Regards
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

Hi tai!
tai wrote:..., I am using the latest kernel I believe:

Code: Select all

debian@beaglebone:/dev$ uname -r
4.14.71-ti-r80
The latest kernel is 4.19.x, currently. But 4.14.x is the latest stable.

Sorry, I cannot help. You're using a -ti- channel, while I only use and test -bone- channels. So either switch your system to bone, or ask at a TI forum how to get the uio_pruss driver running at your system. The target is that the driver creates the interrupt files /dev/uio[0-7].

Regards
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: libpruio (BB D/A - I/O fast and easy)

Post by Dinosaur »

Hi TJF

I have ordered my pcb's and will have 4 to play with in about 10 days.
The board is the same size as the BBB without cutouts for Ethernet etc.
By utilising a Male to Male pin header in the BBB and a Female on the underside of my board, there will be clearance.
It has:
8 Opto inputs (5 to 24 vdc)
20 Fet outputs with 3.2 A each. I have split it into 2 banks of 10, so that the tracks support 7.5 A per 10 outputs.
The production units will have a 50 % increase in current by using 1.5 oz copper instead of 1 oz.
As I said, I like to design for the Max.So you can directly drive a higher voltage Stepper.

Because of the issue of the outputs being ON at bootup, I have incorporated 2 additional Fet's to interrupt the Common on each 10 output side.
The user will have to provide a 5-24 vdc input to enable these. (ie: Through E-Stop or Stop/Start station)
I haven't tested that yet as these Fet's won't conduct unless the voltage rises on the board common rail.
So that may mean that the common on the board will be 1 v or so higher then the actual common.
But if it doesn't work, a bridge between two terminals will solve that and then the protection will have to be external.

Once I have completed the test, I will PM you regarding sending you a unit for all the help.
You can bin it, give it away or play with it.

Regards
PS: Broadly speaking how would you (or have you) implement a PWM output of a fixed number of pulses.
All the reading I have done incorporates putting the o/p to an i/p and then polling for the count. (messy)
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

Hi Dinosaur!
Dinosaur wrote:PS: Broadly speaking how would you (or have you) implement a PWM output of a fixed number of pulses.
All the reading I have done incorporates putting the o/p to an i/p and then polling for the count. (messy)
I haven't done this yet. The solution depends on the capabilities of the subsystem that generates the PWM pulse train. In your case (P9_21) the B channel of the ePWM module of the PWMSS-0 subsystem is used. This module has an Event-Trigger submodule that can generate interrupts, ie. when the time based counter matches the compare B register. So you can count by fetching interrupts. Find details in the CPU TRM section 15.2.

You can manipulate the registers in structure PwmssSet (before starting the main loop by io->config()), which is io->PwmSS->Conf(0)->XXX_REG_NAME in your case. The UDT member names are equal to the names in the TRM.

Regards
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: libpruio (BB D/A - I/O fast and easy)

Post by TJF »

Hi tai!
tai wrote:..., I am using the latest kernel I believe:

Code: Select all

debian@beaglebone:/dev$ uname -r
4.14.71-ti-r80
You may find helpful hints here (old boot loader on eMMC)

https://groups.google.com/d/msg/beagleb ... WoWp2jAQAJ

Regards
Post Reply