• AVR Freaks

Hot!Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost

Page: 12 > Showing page 1 of 2
Author
GlennP
Super Member
  • Total Posts : 780
  • Reward points : 0
  • Joined: 2009/03/29 15:04:55
  • Location: El Paso County, CO, USA
  • Status: offline
2020/06/28 01:13:49 (permalink)
0

Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost

I vaguely remember a comment about a particular 16-bit family being flaky and/or having a huge set of Errata.
 
A search for the post has come up empty, but I've failed "Searching for Posts" 1.01 each time I take it.
 
I need a 16-bit MCU with a Quadrature Encoder Interface that's fairly fast (50 MIPS would be fine) but I do not require much code or data space.  My preliminary candidate is the dsPIC33EP32MC202 (unless I later discover I need more pins).  That device (regardless of memory sizes and packaging) has issues with the Index pulse in the QEI, but that isn't an issue with this application.
 
I can also use a PIC24 as there is nothing added in the dsPIC33 that I think I need, but the pricing and power are so close I thought I'd live it up with the '33' version unless there is a reason to avoid it.
 
Anyone who remembers the discussion (or has any new observations) and can point me back to it would be appreciated.
 
Thanks,
GlennP
#1

38 Replies Related Threads

    RISC
    Super Member
    • Total Posts : 5776
    • Reward points : 0
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/01 13:33:39 (permalink)
    0
    Hi Glenn,
    As far as I can see in the erratashet the device you intend to use  (dsPIC33EP32MC202)  does not have any silicon bugs in latest silicon revision (A9).
    Regards

    For support make sure to check first here : http://microchipdeveloper.com
    There are hundreds of PIC, AVR, SAM...which one do YOU use ?
    #2
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3984
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/01 17:43:56 (permalink)
    2 (3)
    The CH cpu has 2 x Quadrature Encoder Modules.

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #3
    GlennP
    Super Member
    • Total Posts : 780
    • Reward points : 0
    • Joined: 2009/03/29 15:04:55
    • Location: El Paso County, CO, USA
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/01 18:40:03 (permalink)
    0
    RISC
    Hi Glenn,
    As far as I can see in the erratashet the device you intend to use  (dsPIC33EP32MC202)  does not have any silicon bugs in latest silicon revision (A9).
    Regards



    RISC:
     
    I hope you are correct, but I don't see an A9 for any except the '256' version.
     
    The information on pages 1 and 2 indicates to me at least that A8 is the latest revision except for the '256' version.  See attached GIF.
     
    GP
     

    Attached Image(s)

    #4
    GlennP
    Super Member
    • Total Posts : 780
    • Reward points : 0
    • Joined: 2009/03/29 15:04:55
    • Location: El Paso County, CO, USA
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/01 19:01:34 (permalink)
    0
    Gort:
     
    Those are quite powerful chips, but the lowest cost ones are over twice the price of the EP version.
     
    This is a cost-sensitive application and the issue with the QEI doesn't not interfere with the planned use of the Encoder interface.
     
    Thanks though - I will take another look at the datasheet and errata tonight.
     
    GP
    post edited by GlennP - 2020/07/02 03:50:04
    #5
    my504
    Junior Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/21 05:29:36
    • Location: Moskow reg., Fryazino
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 00:13:31 (permalink)
    4 (2)
    Glenn,
    If you write for 16 bits on the ASM16/ASM30, then I would like to warn about the error of the conveyor of this platform when executing the repeat instruction. If this instruction is interrupted in the last iteration, an extra loop occurs, for RAW-instructions. There is a chance of exceeding the address of the array being processed in the loop.
    Workaround. Either make the array one element longer, or disable interruptions before repeat.
     
     
     
     
     
    post edited by my504 - 2020/07/02 01:22:01
    #6
    GlennP
    Super Member
    • Total Posts : 780
    • Reward points : 0
    • Joined: 2009/03/29 15:04:55
    • Location: El Paso County, CO, USA
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 04:01:53 (permalink)
    0
    my504:
     
    Thanks.  So far I haven't needed REPEAT in the one assembly routine I need (an interrupt handler for Timer1***), but if I consider using REPEAT in it I will look at it carefully.
     
    What worries me more is if XC16 emits the REPEAT instruction - particularly for divide or modulo.  How can I fix that?
     
    GP.
     
    ***I know I can write ISRs in C, but for reasons to complicated to go into here, this ISR is run every 5 uSeconds and needs to be as fast as possible.  The C version (O1) was 2x slower than the hand-coded version.  It was taking 60% of the CPU.  Normally I would not put so much in an ISR, but the nature of the problem dictates I have to disobey normal "good design" rules and do what I need in the T1 ISR.
    #7
    JPortici
    Super Member
    • Total Posts : 1114
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: online
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 04:13:20 (permalink)
    0
    my504
    Glenn,
    If you write for 16 bits on the ASM16/ASM30, then I would like to warn about the error of the conveyor of this platform when executing the repeat instruction. If this instruction is interrupted in the last iteration, an extra loop occurs, for RAW-instructions. There is a chance of exceeding the address of the array being processed in the loop.
    Workaround. Either make the array one element longer, or disable interruptions before repeat.
     

    where is this errata exactly? i don't remember ever encountering it
    #8
    my504
    Junior Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/21 05:29:36
    • Location: Moskow reg., Fryazino
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 04:56:39 (permalink)
    5 (2)
    Jack_M
    where is this errata exactly?

    On March 22, 2020, a topic with a problem was opened on a Russian site microchip.su by a colleague from Dnepropetrovsk (UA).
    microchip.su/showthread.php?t=18612

    The problem was repeated by me in hardware and it turned out that this is a pipline problem. A message about this problem was sent to Microchip through the support engineer of the dealer company in St. Petersburg. The Microchip confirmed that it reproduced the problem at home and is working on its solution. Since then no information has been received.
     
     
     
    post edited by my504 - 2020/07/02 05:58:48
    #9
    my504
    Junior Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/21 05:29:36
    • Location: Moskow reg., Fryazino
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 05:24:17 (permalink)
    0
    glennp17321
    What worries me more is if XC16 emits the REPEAT instruction - particularly for divide or modulo.  How can I fix that?

    push/pop RCOUNT
    The pipeline problem is only for type instructions ADD  [W0], W1, [W0++]
    For DIV and  CLR [W0++]  , the problem does not occur.
    post edited by my504 - 2020/07/02 05:28:37
    #10
    RISC
    Super Member
    • Total Posts : 5776
    • Reward points : 0
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 05:28:59 (permalink)
    0
    Hi Glenn,
     
    In the XC compilers, if there are some known erratas for some specific devices, the compiler has a specific command which is added when the project is generated  to not generate the instruction / pattern of instructions :
     -merrata=list argument
    (a good example for that was the PIC18FxxK40 NVM errata/workaround which was automatically impemented by the XC8 compiler).
     
    Another point, to comply with ANSI C (portability), XC16 will not take advantage of specific hardware to generate ASM.
    So, REPEAT will never be generated by a C source file unless you add inline ASM, assembly files or call assembly libraries. Same is true for all the DSP specific instructions.
    Maybe there is even an option for "strict" C somewhere in the XC16 compiler options from the project properties
     
    Regards

    For support make sure to check first here : http://microchipdeveloper.com
    There are hundreds of PIC, AVR, SAM...which one do YOU use ?
    #11
    my504
    Junior Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/21 05:29:36
    • Location: Moskow reg., Fryazino
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 05:37:49 (permalink)
    5 (1)
    RISC
    So, REPEAT will never be generated by a C source file unless you add inline ASM, assembly files or call assembly libraries. Same is true for all the DSP specific instructions.

    The REPEAT instruction is generated by hardware division.
     
     
     
    #12
    JPortici
    Super Member
    • Total Posts : 1114
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: online
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 06:05:57 (permalink)
    0
    Thanks for the link
     
    my504
    glennp17321
    What worries me more is if XC16 emits the REPEAT instruction - particularly for divide or modulo.  How can I fix that?

    push/pop RCOUNT
    The pipeline problem is only for type instructions ADD  [W0], W1, [W0++]
    For DIV and  CLR [W0++]  , the problem does not occur.




    I assume it doesn't include DSP instruction? Because i don't remember encountering this issue using REPEAT and MAC
     
    EDIT: While reading the russian thread, they also refer to this forum link
    https://www.microchip.com/forums/m534998.aspx
     
    IIUC it comes down to saving/restoring the RCOUNT register in the ISR prologue/epilogue (it wasn't 100% clear to me what you exactly meant with push/pop RCOUNT)
     
    post edited by JPortici - 2020/07/02 06:22:11
    #13
    JPortici
    Super Member
    • Total Posts : 1114
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: online
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 06:08:32 (permalink)
    0
    RISC
    Another point, to comply with ANSI C (portability), XC16 will not take advantage of specific hardware to generate ASM.
    So, REPEAT will never be generated by a C source file unless you add inline ASM, assembly files or call assembly libraries. Same is true for all the DSP specific instructions.
    Maybe there is even an option for "strict" C somewhere in the XC16 compiler options from the project properties



    and then there are __builtin and other intrinsics
    #14
    my504
    Junior Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/21 05:29:36
    • Location: Moskow reg., Fryazino
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 06:19:48 (permalink)
    0
    Jack_M
     
    I assume it doesn't include DSP instruction? Because i don't remember encountering this issue using REPEAT and MAC

    I have almost all projects - digital signal processing. I tried to reproduce the problem with the DSP commands, but did not get an error. But the addressing in these commands is much more complicated and perhaps the pipeline does not create an error situation. However, in all current projects, I replaced REPEAT to DO for DSP.
    #15
    my504
    Junior Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/21 05:29:36
    • Location: Moskow reg., Fryazino
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 06:53:06 (permalink)
    0
    glennp17321
     I have to disobey normal "good design" rules and do what I need in the T1 ISR.

    Glenn,
    Do you use the PTG module in the project?
     
     
    #16
    my504
    Junior Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2018/01/21 05:29:36
    • Location: Moskow reg., Fryazino
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 07:01:59 (permalink)
    4 (1)
    Jack_M
    IIUC it comes down to saving/restoring the RCOUNT register in the ISR prologue/epilogue (it wasn't 100% clear to me what you exactly meant with push/pop RCOUNT)

    I answered Glenn about using division in interrupt.
    Saving-restoring RCOUNT does not affect the problem. This is the first thing I explored in analyzing it.
    The link you provided is for the application of RA. This has nothing to do with the problem.
    post edited by my504 - 2020/07/02 07:06:24
    #17
    JPortici
    Super Member
    • Total Posts : 1114
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: online
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 07:05:42 (permalink)
    4 (1)
    RISCwith ANSI C (portability), XC16 will not take advantage of specific hardware to generate ASM.
    So, REPEAT will never be generated by a C source file unless you add inline ASM, assembly files or call assembly libraries. Same is true for all the DSP specific instructions.
    Maybe there is even an option for "strict" C somewhere in the XC16 compiler options from the project properties



    Target: dsPIC33CK256MP508
    Compiler: XC16 v1.50, set to -O0
     
    #include <xc.h>

    int a;
    int b;
    int c;

    int main(void) {
      a = 10000;
      b = 100;
      c = a / b;
     
      while(1) {
        Nop();
      }
    }

     
    gets compiled to
    1:                 #include <xc.h>
    2:                 
    3:                 int a;
    4:                 int b;
    5:                 int c;
    6:                 
    7:                 int main(void) {
    000300  FA0000     LNK #0x0
    8:                   a = 10000;
    000302  227100     MOV #0x2710, W0
    000304  888000     MOV W0, a
    9:                   b = 100;
    000306  200640     MOV #0x64, W0
    000308  888010     MOV W0, b
    10:                  c = a / b;
    00030A  808001     MOV a, W1
    00030C  808010     MOV b, W0
    00030E  780100     MOV W0, W2
    000310  090005     REPEAT #0x5
    000312  D80082     DIV.SW W1, W2
    000314  888020     MOV W0, c
    11:                  
    12:                  while(1) {
    13:                    Nop();
    000316  000000     NOP
    14:                  }
    000318  37FFFE     BRA .L2
    15:                }

     
    if the compiler KNOWS at compiler time that the division will not overflow (16bit by 16 bit) it will use repeat + divide.
    It's been like this for longer than i can remember
     
    but to reiterate it seems to be a problem with RAW instructions or pipeline stalls in general.. Probably the same reason why an instruction that change the program flow can't be at start/end of do loops, since they'll break the pipeline
    post edited by JPortici - 2020/07/02 07:08:24
    #18
    RISC
    Super Member
    • Total Posts : 5776
    • Reward points : 0
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 09:06:04 (permalink)
    0
    Thanks  JPortici for the correction.
    Do you think it was already like this with C30 compiler ?
    Regards

    For support make sure to check first here : http://microchipdeveloper.com
    There are hundreds of PIC, AVR, SAM...which one do YOU use ?
    #19
    NorthGuy
    Super Member
    • Total Posts : 6228
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: Is a Particular 16-Bit Family Considered Unreliable? Previous Post Lost 2020/07/02 09:31:55 (permalink)
    5 (1)
    my504
    push/pop RCOUNT
    The pipeline problem is only for type instructions ADD  [W0], W1, [W0++]
    For DIV and  CLR [W0++]  , the problem does not occur.



    I don't know what problem you're talking about, but if this is saving of the RCOUNT register for the interrupt, you certainly need to do this. If the "repeat" command is interrupted, you enter interrupt, then execute a repeat instruction without saving RCOUNT, the repeat command that was interrupted will malfunction. This applies to division as well. This is not a bug. I'm sure the XC16 compiler is smart enough to save RCOUNT as needed.
     
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2020 APG vNext Commercial Version 4.5