On 2/28/18 10:33 AM, [email protected] wrote:
Hi Mark,

I am interested in doing the same thing (i.e. a basic hall effect sensor connected to the encoder channel on BB Blue). Can you provide more details on how you got it to work? How did you change the control registers in the eQEP hardware?
Could you provide a code sample that I could use?

Justin

On Sunday, June 25, 2017 at 2:12:34 PM UTC-6, Mark Barton wrote:

    On 6/25/17 3:20 PM, Przemek Klosowski wrote:

    On Fri, Jun 23, 2017 at 10:05 AM, Clark
    Sann <[email protected] <javascript:>> wrote:

        Since you don’t care about direction,
        for now, you might try hooking the
        encoder to just the A channel.


    If the decoder is in quadrature mode, this
    probably won't work---it needs the B
    channel signalling to disambiguate the
    direction, so I think the counter will not
    change. This is just my guess based on
    general knowledge, so I may be
    wrong---check it for yourself.
-- 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
    [email protected] <javascript:>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/beagleboard/CAC%3D1GgF8b1KVXTRh%2B3qw_Gg1RjQHhtV74TK1r_fXGizWruBs5Q%40mail.gmail.com
    
<https://groups.google.com/d/msgid/beagleboard/CAC%3D1GgF8b1KVXTRh%2B3qw_Gg1RjQHhtV74TK1r_fXGizWruBs5Q%40mail.gmail.com>.
    For more options, visit
    https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.
    Yep as you and Clark have surmised, neither
    connecting the pulse to A and B would work
    nor connecting just the A input. The counter
    would sometimes decrement if A and B were
    connected, and the counter would simply
    toggle from 1 to -1 if only A was connected.

    However the good news is I was able to get
    it to work by changing one of the control
    registers in the eQEP hardware to a simple
    up count. The encoder pulse is connected to
    the A input whereas B is not used. The pulse
    count is now solid on both channels.

    Mark

--
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 [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/0a66ef55-6f2a-4e70-9e53-0d37b460c3e8%40googlegroups.com <https://groups.google.com/d/msgid/beagleboard/0a66ef55-6f2a-4e70-9e53-0d37b460c3e8%40googlegroups.com?utm_medium=email&utm_source=footer>. For more options, visit https://groups.google.com/d/optout.

Hi Justin,

I modified the roboticscape source that changed  the QDECCTL EQEP register. This changed the encoder from expecting a quadrature input to a simple up counter. Input A should be used to sense the hall effect pulses. I can't remember, but I do believe I had to ground input B This will only work for the first three encoders as the fourth is handled by the PRU. I fully intended to submit my changes so hopefully they would end up in mainline code, however I am not familiar PRU what changes were needed for the PRU. Of course I
moved on to other projects.

I hope this helps
Mark

Here are the sections of code I changed:


In roboticscape.c (just a comment change)
/*******************************************************************************
* int rc_set_encoder_mode(int ch, int mode)
*
* set encoder for quadrature pulses or single pulse. Single pulse on input A
*******************************************************************************/
int rc_set_encoder_mode(int ch, int mode){
    if(ch<1 || ch>4){
        fprintf(stderr,"Encoder Channel must be from 1 to 4\n");
        return -1;
    }
    return write_eqep_mode(ch-1, mode);
}

In rc_nmap_pwmss.c
This is where the real change takes place

//set encoder to quadarature or single pulse mode.
int write_eqep_mode(int ch, int val){
    if(init_eqep(ch)) return -1;
    if(val == MODE_SINGLE_PULSE)
        *(uint16_t*)(pwm_base[ch]+EQEP_OFFSET+QDECCTL) = 0x8000;
    else
        *(uint16_t*)(pwm_base[ch]+EQEP_OFFSET+QDECCTL) = 0x0;
    return 0;
}


In rc_mmap_pwmss.h

//defs for setting encoder mode
enum{
    MODE_SINGLE_PULSE,
    MODE_QUADRATURE
};

--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/0692fbee-86db-8987-c708-757ecef483e7%40atldes.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to