• AVR Freaks

Hot!Possible bug in Code Configurator

Author
davepl
Starting Member
  • Total Posts : 31
  • Reward points : 0
  • Joined: 2016/06/11 01:01:31
  • Location: 0
  • Status: offline
2020/11/17 02:31:30 (permalink)
0

Possible bug in Code Configurator

I'm in the process of adding an mdb uart interface to a PIC32MX470F512H project and think I might have picked up a bug. MDB uses plain 9 bits with no address detection.
Code configurator has generated this uart1 function:
void UART1_Write(uint8_t txData)
{
    while(U1STAbits.UTXBF == 1)
    {
        
    }
    U1MODEbits.PDSEL0;
    U1TXREG = txData;    // Write the data byte to the USART.
}
Note the "uint8_t txData" part. The manual for the PIC32MX specifies UxTXREG and UxRXREG  as having bit 8 for the 9th bit unlike the PIC18's that I've used in the past that have a status bit, TX1STAbits.TX9D, for bit 9.
I can easily work around this so it's not a problem for me.
#1

6 Replies Related Threads

    Mysil
    Super Member
    • Total Posts : 4071
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: Possible bug in Code Configurator 2020/11/17 03:35:14 (permalink)
    4.33 (6)
    Hi,
    I think the MCC is not supposed to deal with 9 bit UART communication at all.
    I think it is not a bug, I think it is a deliberate simplification, or omission.
     
    There are many features of PIC hardware, that is not supported by MCC code.
    Especially for PIC32MX devices.
     
    In PIC32MX devices, the UART peripheral may be set up to generate parity bits in the 9. bit in hardware.
     
    For a communication protocol using 9 bit communication, you should modify the generated code as needed.
     
    MDB ? are you dealing with Microchip command line DeBugger, or something else?
     
        Mysil
    #2
    ric
    Super Member
    • Total Posts : 29496
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Possible bug in Code Configurator 2020/11/17 05:05:54 (permalink)
    3.67 (3)
    Why give someone 1 star when they are just pointing out the facts?
    That sort of behaviour makes people reluctant to bother helping at all.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #3
    du00000001
    Just Some Member
    • Total Posts : 4081
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: Possible bug in Code Configurator 2020/11/17 05:40:31 (permalink)
    3.5 (2)
    @Mysil
    MDB(/ICP) the bloke is referring to seems to be the "Multidrop Bus" internal to vending machines, which somewhat (ab-)uses the 9th bit (initially intended to allow to differentiate between addresses and data).
     
    @ric
    Why not just give Mysil a +5? Won't heal the effect of the 1 completely, but is kind of a remedy  :)

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #4
    RISC
    Super Member
    • Total Posts : 5908
    • Reward points : 0
    • Status: offline
    Re: Possible bug in Code Configurator 2020/11/17 05:46:16 (permalink)
    3.5 (2)
    Hi,
    PIC32 support in MCC has been frozen since a couple of years (that is what I got from technical support).
    It stays as it was with some bugs and limitations.
    You should really use Harmony v3 libraries for PIC32 products.
    Regards
     

    For support make sure to check first here : http://microchipdeveloper.com
    There are hundreds of PIC, AVR, SAM...which one do YOU use ?
    #5
    Mysil
    Super Member
    • Total Posts : 4071
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: Possible bug in Code Configurator 2020/11/17 06:33:00 (permalink)
    3.5 (2)
    Thanks guys,
     
    I have got so many stars, I can take a hit sometimes.
     
    I kind of like MCC for PIC32MX.
    It make code that is recognizable with reference to the Datasheet,
    and is portable PIC32MX, PIC32MM, PIC24, dsPIC and PIC18, PIC16 ...
    within the abilities of devices and peripherals.
     
        Mysil
    post edited by Mysil - 2020/11/17 06:47:57
    #6
    davepl
    Starting Member
    • Total Posts : 31
    • Reward points : 0
    • Joined: 2016/06/11 01:01:31
    • Location: 0
    • Status: offline
    Re: Possible bug in Code Configurator 2020/11/17 08:45:05 (permalink)
    0
    Thanks, it's not really a problem, the RX and TX registers are defined as uint32_t in the p32mx*.h headers.
    I dislike harmony, it never allows me to do what I want. It's cumbersome especially as I have a slow internet connection.
    Thanks for the help
    Yes it's Multi Drop Bus for vending machines
    #7
    Jump to:
    © 2021 APG vNext Commercial Version 4.5