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

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
Dinosaur
Posts: 1303
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

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

Postby Dinosaur » Apr 25, 2019 21:20

Hi TJF

Seeing as you did not get the emails, you also then didn't get the explanation of the .pdf's that I uploaded to you.
Here it is.
As an analyses;
The swapping feature of sending the CRO output to P9_42 did not work.
The only output I ever got was on P8_07.

It doesn't matter what the Dur1 or 2 are, the results are the same.
It turned out to be easier to see with 5 , 5

The pulses are only visible with one shot's. But that makes sense as the pulse happens at the start
of the "Space" which in Pwm mode is the end of previous pulse.

The pulses only ever happen at the start of the "Space Time" regardless of Invert or not, or Pullup / down / none.
If the Dur1 = 7 and Dur2 = 3 then 7 mSec before the valid pulse the rogue pulse will happen.

Sometimes it takes 30 or more "One Shots" to get a pulse , other times it happens on the second try.
I simply kept pressing 5 with "Single Trace" mode on the CRO.


Attached a zip file with 6 .pdf's
Dur1 Dur2 Mo Res.
1.pdf 7 3 10 None
2.pdf 7 3 10 Down
3.pdf 5 5 10 Up
4.pdf 5 5 11 None
5.pdf 5 5 11 Down
6.pdf 5 5 11 Up


Regards
Dinosaur
Posts: 1303
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

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

Postby Dinosaur » Apr 29, 2019 13:51

Hi TJF

I have another problem which I can't identify.
It involves reading 1 input 24 times which "appears" to fail after correctly reading
about 16 to 18 bits, and then getting it wrong at least twice in the last 6 bits.

It involves 1 input (Data) and 1 output (Clk)
Basically the procedure is as follows.

For Xq = 23 to 0 Step -1
1. Wait for input to go Low
2. Send Clk output ON (which I manage to do in 23 micro sec's according to the CRO)
3. Within nano seconds of the Clock going Hi, the Data bit to read is valid.
4. Delay reading Data input with "For Xy=1 to 900:Next Xy"
If the Clk is Hi for more then 60 uSec the Data bit goes Hi and Stays Hi (Sleep mode)
The CRO output shows a vey reliable 20 uSec pulse, so untill the Clk is Lo the Data bit is valid.
5. Save the Data bit by "BitSet(BitValue,Xq)"
6. Clk output OFF.
7. Delay repeat to 1 above with "For Xy=1 to 250:Next Xy"
So clock Lo time is shorter then Hi time.
Next Xq
Now send the 25th Clock pulse to finish the transaction.
This pulse can be very short which is visible on the .pdf I send to you.

The example on the pdf shows:
000000101010101010100010 CRO Output
000000101010101010110011 PC Output

The first 16 to 18 bits are NEVER wrong.
I record all the readings and store them in both Integers and Bit string, so that I can
compare the bit string to the Integer.

Also there are sometimes a few "overshoot" spikes on the Clk, but it never shows
any spikes in the Data bit area (Blue Trace).
Typically it will read a 1 where there should be a 0.

Don't know if this complicates the debugging that you are doing, or shed light
either way I thought it may help.

Case 1 in the code below is the critical part.

Code: Select all

'----------------------------------------------------------
' Program to read HX711 A2D converter board.
' P8_11 is I/P of Data , P8_14 is Clock O/P
'----------------------------------------------------------

#INCLUDE ONCE "BBB/pruio.bi"
#INCLUDE ONCE "BBB/pruio_pins.bi"
Type Adcs
    StepNbr     As Integer
    Init        As Integer
    Errer       As Integer
End Type
Dim Shared Adc As Adcs
Type Accums
    Counts(1 To 100)   As Integer
    AvgCount           As Integer
    Samples            As Integer       'How many samples for each record (from Product.jvp)
    Total              As Double
    HiValue            As Integer
    LoValue            As Integer
End Type
Dim Shared As Accums Accum
Dim Shared As Double CalTime, GapTime,StartTime
Dim Shared as Integer StepInc, Xq,Xy,Xz
Dim Shared as Integer BitValue
Dim Shared BitStr As String * 24
Dim Shared io As PruIo
'=====================================================================
Sub GetA2D
  With Adc
    Select Case .StepNbr
        Case -1 'Second call here if No Errer.
            If .Init Then
                .StepNbr = 1
            EndIf
        Case 0  'First call is here.
            BitValue = 0
            IF io.Gpio->config(P8_14 , PRUIO_GPIO_OUT0) THEN .Errer = 1   ''"P8_14 Config Error"
            IF io.Gpio->config(P8_11 , PRUIO_GPIO_IN_0) THEN .Errer = 2   ''Print "P8_11 Config Error"
            IF io.config() THEN
                .Errer = 3
                Exit Sub
            EndIf
            .Init = 1
            .StepNbr  = -1
        Case 1  'Wait for next Data Rdy pulse.
            Do
                If StepInc < 1 Then
                    GapTime = (Timer - CalTime) * 1000                  'mSec for gaps between reads.
                    StepInc = io.Gpio->Value(P8_11)                     'If 1, then we have sync.
                EndIf
                If StepInc = 1 Then
                    If io.Gpio->Value(P8_11) = 0 Then                   'When Zero, msb data is Rdy.
                        BitStr = ""
                        For Xq = 23 to 0 Step -1                        '30 uSec later first Clck for 24 Bits
                            io.Gpio->SetValue(P8_14, 1)                 'Set Clock ON.
                            For Xy = 1 to 900: Next Xy                  'Wait 900 (23 uSec)
                            Xz = io.Gpio->Value(P8_11)                  'then read state of bit
                            If Xz Then BitValue = BitSet(BitValue,Xq)   'Set Bit if Hi.
                            io.Gpio->SetValue(P8_14, 0)                 'Got bit, so turn Clock OFF.
                            If Xz Then BitStr = BitStr + "1" Else BitStr = BitStr + "0"
                            For Xy = 1 to 250: Next Xy                  '100 = approx 2.5 uSec
                        Next Xq                                         'Do for 24 bits
                        io.Gpio->SetValue(P8_14, 1)                     'Set 25th (end) Clock ON.
                        For Xy = 1 to 100:Next                          'Short wait is ok for this one.
                        io.Gpio->SetValue(P8_14, 0)                     'Set Clock OFF.
                        StepInc  = 0                                    'Cancel Flag
                        .StepNbr = 2                                    'Go wait for Main
                        Exit Do
                    EndIf
                EndIf
            Loop
        Case 2  'Crunch Data in Main loop & set next Step.

        Case 3
            If (((Timer - CalTime) * 1000) - GapTime) > 90 Then         'After 90 mSec,
                 BitValue = 0 :BitStr = ""                              'Total time as per CRO 600 uSec
                .StepNbr  = 1                                           'start looking again.
            EndIf
    End Select
  End With
End Sub
'=====================================================================
    CalTime = Timer
    Do
        GetA2D
        If Adc.StepNbr = 2 Then
            Accum.Samples += 1
            Accum.Counts(Accum.Samples) = BitValue
            Adc.StepNbr = 3
            Print "BitStr  = ";BitStr
            Print BitValue;"         ";Bin(BitValue)
        EndIf
        If Adc.Errer > 0 Then Goto Err_End
        If Inkey = "q" Then Exit Do
        If Accum.Samples = 10 Then Exit Do
    Loop
    With Accum
        .LoValue = &H7fffff
        .HiValue = 0
        For Xq = 1 to .Samples
            Print .Counts(Xq),"  ";Bin(.Counts(Xq))
            If .Counts(Xq) > .HiValue Then .HiValue = .Counts(Xq)
            If .Counts(Xq) < .LoValue Then .LoValue = .Counts(Xq)
            .Total += .Counts(Xq)
        Next
        Print "Average = ";.Total / .Samples
        Print "HiValue = ";.HiValue
        Print "LoValue = ";.LoValue
        Print "Variant = ";.HiValue - .LoValue
    End With
    End

Err_End:
    Select Case Adc.Errer
        Case 1
            Print "Adc Clock Config Error"
        Case 2
            Print "Adc Bit   Config Error"
        Case 3
            Print "io.Config Error"
    End Select
    End

EDIT:
Additional info.

The first time I switch the Clk output, I can't get it ON before 100uSec and then the Minimum ON time is 100 uSec,
which results in an invalid reading. I have ignored that until today and started looking and testing.

If I switch the Clk to zero first (which it already is) , and then switch it ON, it will switch within 40 uSec
and have the same pulse width as the rest (23 uSec).

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

Version 0.6.6 is out

Postby TJF » May 09, 2019 12:52

Version 0.6.6 is uploaded now:

* new: second parameter in function prussdrv_pru_enable() = start at
* new: function prussdrv_pru_resume() for restart after SLP 1 or HALT
* new: TIMER one shot mode with counter
* fix: examples pruss_[add|toggle], resume function implemented
* fix: function prussdrv_exIt(), optimized cleanup
* fix: PRU systems config: copies regs for disabled subsystems now
* fix: PRU code, reg PWMSS.TZCTL config
* fix: evaluation in Pwm/Tim->Value functions fixed
* fix: TIMERSS generated timers, start peak removed, one shot optimized
* fix: file pruio.py, macro PruReady removed
* fix: file rb_file.py, correct pointer p1 computation
* fix: gen. invalid pointer AdcUdt::Value in case of config error

The peaks at the beginning of the TIMER output should be gone now. I fixed the one shot mode and also implemented a counter, so a TIMER can fire 1 to 255 pulses now.

Regards
Dinosaur
Posts: 1303
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

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

Postby Dinosaur » May 09, 2019 15:11

Hi All

Thank you TJF, will test whatever features I can and get back to you.

Have one arm in sling at the moment, (huge carcinoma removed from back), so one handed typist.

Regards
Dinosaur
Posts: 1303
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

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

Postby Dinosaur » May 09, 2019 18:05

Hi TJF

Looking Good.
The Single shot (or multiple) works as you described and has NO premature pulses.
Don't know what effort was involved in nailing that , but is was worth it.
It is a great feature, WELL DONE.

You have also solved the delay on the first o/p write by the look of it.
When reading my HX711 board previously, I had to write 0 to the port bit first, after which the next Hi was fast for the all the following cycles.
Now when I eliminated this zero write, it shows a few micro sec longer, but well within tolerance.
So now, I don't have the first reading of the board failing.

Will keep testing.

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

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

Postby TJF » May 09, 2019 18:36

Hi Dinosaur!
Dinosaur wrote:Looking Good.
The Single shot (or multiple) works as you described and has NO premature pulses.
Don't know what effort was involved in nailing that , but is was worth it.
It is a great feature, WELL DONE.
Thanks. I didn't notice this issue, since I don't have proper measurement equipment. Now I developed a fast data logger running on the second PRU, in order to observe the output. My first two shots didn't work good enough, but the third shot did the job, so that I could optimize.

The premature pulses were coming from an undefined state during the hardware registers update.

Regards
Dinosaur
Posts: 1303
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

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

Postby Dinosaur » May 10, 2019 0:37

Hi TJF

A minor problem that I have solved with software.
However, you should be aware of it, so IF it is a library problem, others may not discover it.

I noticed that with reading 40 readings of 24 bits, there was times when my Clk output was longer then
what was possible with the loops of Xy in the program below.
I understand that I am doing a "Real Time" read in a "non Real Time" OS, but I have never had 7 mSec of error before.

Code: Select all

        Case 1  'Wait for next Data Rdy pulse.
            StepInc    = io.Gpio->Value(P8_11)                          'Read Data Rdy. Bit'
            TimesmSec  = (Timer - CalTime) * 1000                       'Record the time we raed it'
            If StepInc Then                                             'If 1, then we have sync.
                GapTime    = TimesmSec - StartTime                      'Current time - last StartTime
                StartTime  = TimesmSec                                  'New Hi start Time'
                Do
                    io.Gpio->SetValue(P8_14, 0)                         'Prime bit for fast writes.
                    If io.Gpio->Value(P8_11) = 0 Then                   'When Zero, msb data is Rdy.
                        Accum.Samples += 1                              'inc the sample count.
                        For Xq = 23 to 0 Step -1                        '30 uSec later first Clck for 24 Bits
                            io.Gpio->SetValue(P8_14, 1)                 'Set Clock ON.
                            HiTime = (Timer - CalTime) * 1000000           'Record the time we set it Hi
                            For Xy = 1 to 500: Next Xy                  'Wait 500 loops
                            Xz = io.Gpio->Value(P8_11)                  'then read state of bit & save it.
                            io.Gpio->SetValue(P8_14, 0)                 'Got bit, so turn Clock OFF first,
                            If Xz Then BitValue = BitSet(BitValue,Xq)   'Set Bit if Hi.
                            LoTime = (Timer - CalTime) * 1000000           'Record the time we set it Lo
                            Accum.OnTime(Accum.Samples) = LoTime - HiTime
                            If (LoTime - HiTime) > 50 Then              'at 60 the chip shuts down.
                                BitValue = 0
                                Exit For
                            EndIf
                            For Xy = 1 to 100: Next Xy                  '100 = approx 2.5 uSec
                        Next Xq                                         'Do for 24 bits
                        io.Gpio->SetValue(P8_14, 1)                     'Set 25th (end) Clock ON.
                        For Xy = 1 to 100:Next                          'Short wait is ok for this one.
                        io.Gpio->SetValue(P8_14, 0)                     'Set Clock OFF.
                        StepInc  = 0                                    'Cancel Flag
                        .StepNbr = 2                                    'Go wait for Main
                        Exit Do
                    EndIf
                Loop
            EndIf
        Case 2  'Crunch Data in Main loop & set next Step.
So I inserted time recording lines, and if the time was > 50 I discard the reading because the chip goes into sleep mode
which results in those very long (545 mSec) Gap Times for the chip to wake up again.
This long Clk o/p could be any of the 24 bits that I am clocking.
The results of 40 typical reads are below.

Code: Select all

Rec.Counts    Binary                   GapTime   Clk.HiTime in uSec
 1   176644   101011001000000100       76         13
 2   176701   101011001000111101       1          12
 3   176650   101011001000001010       100        12
 4   176621   101011000111101101       100        13
 5   176647   101011001000000111       104        13
 6   176650   101011001000001010       96         13
 7   176656   101011001000010000       100        13
 8   176662   101011001000010110       101        12
 9   176662   101011001000010110       99         12
 10  176682   101011001000101010       103        12
 11  176604   101011000111011100       97         12
 12  176647   101011001000000111       107        12
 13  176691   101011001000110011       96         12
 14  176670   101011001000011110       97         13
 15  0        0                        100        223
 16  176592   101011000111010000       103        13
 17  0        0                        545        7985
 18  176612   101011000111100100       108        13
 19  176638   101011000111111110       548        13
 20  176614   101011000111100110       97         12
 21  176678   101011001000100110       100        12
 22  176691   101011001000110011       100        12
 23  176617   101011000111101001       103        12
 24  176646   101011001000000110       97         12
 25  176630   101011000111110110       100        13
 26  176583   101011000111000111       100        12
 27  176636   101011000111111100       103        13
 28  176667   101011001000011011       97         12
 29  176601   101011000111011001       100        13
 30  0        0                        100        73
 31  176629   101011000111110101       103        13
 32  176617   101011000111101001       545        12
 33  176604   101011000111011100       107        12
 34  176607   101011000111011111       93         12
 35  176656   101011001000010000       100        12
 36  176651   101011001000001011       100        13
 37  176558   101011000110101110       108        13
 38  176597   101011000111010101       92         13
 39  176601   101011000111011001       100        12
 40  176576   101011000111000000       100        13
Valid Reads =  37
Average Val.=  176635
HiValue     =  176701
LoValue     =  176558
Variation   =  143
I can do one or two without any errors, and then there will be two errors in 40 reads.
The Gap time is the time it takes for the chip to send a pulse that signifies "Data Rdy.", which according to the CRO is very stable.
The Clk HiTime is the duration of "For Xy = 1 to 500: Next Xy" which may vary by a couple of mSec
but not hundreds.
I filter out the rogue readings and conclude on the average as shown above.

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

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

Postby TJF » May 10, 2019 6:48

Hi Dinosaur!
Dinosaur wrote:I understand that I am doing a "Real Time" read in a "non Real Time" OS, but I have never had 7 mSec of error before.
You're working on a system without GPU support. The main CPU has to compute all the graphic bits. Now you're at the point where you can understand why I recommended at the very first beginning not to use Ubuntu, but a Debian console image instead.

Anyhow, there is a 28 bit shift capture feature in the PRUSS (P8_45 for PRU-0, and P9_31 for PRU-1), see 'AM335x PRU-ICSS Reference Guide' section 5.2.2.3.3. This guide is in package am335x_pru_package. But the minimal frequency is 8 MHz, which may be too fast for your sensor.

Perhaps dropping Ubuntu will do the trick. But it'd be best for reliable transfers to implement the bit banging by a little PRU code running on the other PRU.

Regards

PS: In the newer images there's a wayland SGX driver available, which may accelerate the Ubuntu graphics (untested).
Dinosaur
Posts: 1303
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

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

Postby Dinosaur » May 10, 2019 13:25

Hi TJF

I never succeeded with the full Ubuntu desktop image, however I did with Debian full desktop,
which is my current desktop on uSD.
I guess I am testing in the worst possible way, full desktop running Geany, then
running the program from Geany in a Terminal.
Still it is a graphics desktop.

It is also a long leap from 1 mSec repeatability on my Fitlet's to 30 uSec on the BBB.

If I get the time I will test it in terminal and see, but for the moment I will leave it.
I don't have enough experience with PRU's to attempt anything there.
Also thought about RB mode, but the only examples you have are for AIN and I cant find how to read
gpio in RB mode.

Anyway will keep at it and am pleased with the changes you have made.

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

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

Postby TJF » May 10, 2019 15:01

Hi Dinosaur!
Dinosaur wrote:Also thought about RB mode, but the only examples you have are for AIN and I cant find how to read
gpio in RB mode.
AIN with strong timing is the main prupose of that mode. As long as you don't use the internal ADC, the RB mode is no option at all. GPIO is less deterministic in RB.

Regards
Dinosaur
Posts: 1303
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

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

Postby Dinosaur » May 16, 2019 21:16

Hi TJF

Have finally got my High Current board working the way it should, but there is one anomaly.

When powering up the BBB, the outputs are at 3.3 vdc.
This leaves my output voltage at zero as a result of a P-Channel Mosfet.

When I run my application I initialize the "Power bit" P8-19 with

Code: Select all

.Gpio->config(P8_19,PRUIO_GPIO_OUT1)
which leaves that output at 3.3 vdc.
Then when I consider it safe, I switch that power bit Off and the 24 vdc power comes ON to all the loads.
So far so good.
However, when I Quit my program (and thus the Library) that bit is set to Off by the library, and consequently the Output Power comes ON again.

Is that intentional ? , I would have thought you would leave them in whatever state I leave them in.
Or alternatively in the same state as at boot.
The last statements are

Code: Select all

io.GPIO->SetValue(8,1)
Sleep
Close
End
The Power is OFF untill I press Enter.

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

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

Postby TJF » May 17, 2019 5:53

Hi Dinosaur!
Dinosaur wrote:Have finally got my High Current board working the way it should, ...
Congrats!

Dinosaur wrote:When powering up the BBB, the outputs are at 3.3 vdc.
This leaves my output voltage at zero as a result of a P-Channel Mosfet.
Why invers logic? When the power supply for the BBB breaks down, your board makes party?

Dinosaur wrote:When I run my application I initialize the "Power bit" P8-19 with

Code: Select all

.Gpio->config(P8_19,PRUIO_GPIO_OUT1)
which leaves that output at 3.3 vdc.
Then when I consider it safe, I switch that power bit Off and the 24 vdc power comes ON to all the loads.
So far so good.
However, when I Quit my program (and thus the Library) that bit is set to Off by the library, and consequently the Output Power comes ON again.

Is that intentional ? , I would have thought you would leave them in whatever state I leave them in.
Or alternatively in the same state as at boot.
It's intentional that libpruio leaves the subsuystems in the same state as they were before the CTOR was called. That is the default behaviour realised by the DTOR code. But you're free to manipulate its data, so that the DTOR wont touch certain pins, or set them in a specific state.

I'd make the "Power Bit" high-active, and use a pull-down resistor for safety reasons. Since P8_19 comes up after boot as input without resistor, the pull-down should resist on your board.

Regards
Dinosaur
Posts: 1303
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

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

Postby Dinosaur » May 18, 2019 2:07

Hi TJF

Why inverse logic? When the power supply for the BBB breaks down, your board makes party?
Although I did not think of that, it is not possible.
Yes when the 5 v is removed the 24 vdc power is turned On to the 20 outputs, BUT because there is no 3.3 v to drive the outputs ON
the loads do not activate.
The inverse logic is because to "supply" power (source) you need a P-Channel Mosfet. This requires Hi vdc on gate to turn Off.
So the solution appeared simple, as the outputs are at 3.3 vdc at boot, just use it to drive the opto to turn on the Hi gate voltage.

Two traps for the unwary.
1. I did not realise that some GPIO pins boot Low. P8_19 in point.
2. The pullup resistor on the pins that boot Hi (3.3v) dont allow enough current to drive the opto.

So, solution was one wire and resistor to "assist" the pin to drive the opto.
The last spare o/p was P9_26 which is now the "Power bit" (hi active).
So the board is now completely safe from 24vdc regardless of the order in which power is applied.
As soon as the power button is pressed the 24 vdc turns Off, and does not activate until the program allows it.

I must admit I am very impressed with this little board and what it can do.
The uSD is fully loaded with all my needs and runs at a scan time of between 9-11 uSec.
Having been in the Computerised weighing business for 35+ years, I concluded that the Hx711 A2D is worth as much as you pay for it. $15
So, binned them.
I interfaced two "OnTrak" ADU70 via usb and perfected a dual trace CRO screen as part of my GUI and it is very responsive, even with a cheap
load cell.

Anyway, enough rambling, will keep testing and stretching the limits.
Many thanks for your help and advise.

Regards
Dinosaur
Posts: 1303
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

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

Postby Dinosaur » May 29, 2019 16:27

Hi TJF

Experimenting with: Direction Count mode.

I Quote:
Some position encoders provide direction and clock outputs, instead of quadrature outputs. In such cases,
direction-count mode can be used. QEPA input will provide the clock for position counter and the QEPB
input will have the direction information. The position counter is incremented on every rising edge of a
QEPA input when the direction input is high and decremented when the direction input is low.

The manual quotes that:
The QSRC bits 14 & 15 in QDECCTL register neeeds to be set to 1h for Direction Count mode.
However there does not appear to be any way to do that (within the library).

Looking at config in your examples you use only
.Qep->config(Pins(0),pMax,Vhz) when you config the Qep.

Looking at the manual:
.Qep->config(Ball,pMax,VHz,scale,Mo)

Is the Mo the interface to the QDECCTL register ?
I also note that in the description of the Qep it looks like this feature (Direction Count mode)
has not been allowed for.

Can you confirm if that is the case, or How to set the QDECCTL register to activate this mode.

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

Postby TJF » May 29, 2019 20:32

Hi Dinosaur!
Dinosaur wrote:The manual quotes that:
The QSRC bits 14 & 15 in QDECCTL register neeeds to be set to 1h for Direction Count mode.
However there does not appear to be any way to do that (within the library).
io->PwmSS->Conf(_X_)->QDECCTL = ..., where _X_ is the number of the related subsystem [0-2]. But the function io->Qep->config() overrides the setting. You've to code your own config function.

Regards

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 1 guest