2020/11/17 02:31:30
davepl
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.
2020/11/17 03:35:14
Mysil
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
2020/11/17 05:05:54
ric
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.
 
2020/11/17 05:40:31
du00000001
@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  :)
2020/11/17 05:46:16
RISC
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
 
2020/11/17 06:33:00
Mysil
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
2020/11/17 08:45:05
davepl
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
© 2021 APG vNext Commercial Version 4.5

Use My Existing Forum Account