• AVR Freaks

Hot!High speed serial on PIC24EP128

Page: < 12 Showing page 2 of 2
Author
asm_uchip
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2019/07/30 18:26:05
  • Location: 0
  • Status: offline
Re: High speed serial on PIC24EP128 2021/01/12 21:28:24 (permalink)
0
ric
That is a side effect of the posts that have vanished. The page-count mechanism thinks they are still there.
It will disappear in another post or two (when there really is a page#2).


OK thanks for the heads-up.
 
Back to the topic at hand, based on the feedback this "input/output impedance" information isn't available from datasheet. Some of the posters (forumers?) have also raised a point that this device might not be able to achieve 16MBauds. On this, the board is at prototype stage; we want to get the best layout possible so that if we can't achieve the speed it's not due to the device and not other things.
 
Based on the feedback I can sum to 2 possible solutions:
  • add line transceiver/buffer
  • Keep tracks as short as possible
Any other suggestions (other than "use another interface" --> high speed UART is part of project requirement and not my call to make) /precautions on high speed UART layout?
#21
Jerry Messina
Super Member
  • Total Posts : 714
  • Reward points : 0
  • Joined: 2003/11/07 12:35:12
  • Status: offline
Re: High speed serial on PIC24EP128 2021/01/13 06:03:32 (permalink)
4.33 (3)
Keep tracks as short as possible

As others have already said, it's likely your problems are going to start at the connector/ribbon cable, not so much with the pcb traces. For them you'll probably be ok as long as the signals are routed over a continuous GND plane.
 
How long of a cable are you thinking of?
#22
RISC
Super Member
  • Total Posts : 6075
  • Reward points : 0
  • Status: online
Re: High speed serial on PIC24EP128 2021/01/13 13:34:21 (permalink)
0
Hi,
Just in case : the dsPIC33CH and dsPIC33CK families have UARTs specified up to 25Mbits/s 
e.g. dsPIC33CK128MP202   (see table 31-32 : UA10 parameter UART baud time min = 40ns)
Regards
 

For support make sure to check first here : http://microchipdeveloper.com
There are hundreds of PIC, AVR, SAM...which one do YOU use ?
#23
Antipodean
Super Member
  • Total Posts : 2059
  • Reward points : 0
  • Joined: 2008/12/09 10:19:08
  • Location: Didcot, United Kingdom
  • Status: offline
Re: High speed serial on PIC24EP128 2021/01/14 11:59:25 (permalink)
4.2 (5)

Thursday, January 14, 2021 11:07 AM

CinziaG gave a 2 Star (-1) to your post titled:

"Re: High speed serial on PIC24EP128"

 
Oh dear, we strike again ...
 

Do not use my alias in your message body when replying, your message will disappear ...

Alan
#24
asm_uchip
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2019/07/30 18:26:05
  • Location: 0
  • Status: offline
Re: High speed serial on PIC24EP128 2021/01/14 19:04:29 (permalink)
0
Jerry Messina
Keep tracks as short as possible

As others have already said, it's likely your problems are going to start at the connector/ribbon cable, not so much with the pcb traces. For them you'll probably be ok as long as the signals are routed over a continuous GND plane.
 
How long of a cable are you thinking of?


The one we are currently using right now is around 18cm.
 
In any case, the requirement is to ensure that the board is capable of supporting of 16Mbauds max data transfer rate . Our current system with which we are going to use this board supports up to 6Mbauds. It's mainly for future use, not immediate
#25
Jerry Messina
Super Member
  • Total Posts : 714
  • Reward points : 0
  • Joined: 2003/11/07 12:35:12
  • Status: offline
Re: High speed serial on PIC24EP128 2021/01/15 06:12:59 (permalink)
5 (1)
If you want to use a single-ended approach I'd arrange the uart signals on the cable to alternate with GND traces...
GND
TX
GND
RX
GND
You get better impedance control and isolation that way.
 
Also, add provisions for a small series R right at the TXD pin of the uC. Something like 100-120 ohms would probably work for such a short cable. It'll reduce the edge rates so you get less reflections. Not as big a deal with async signals, but as you get faster and faster bit rates the reflections become a larger part of the bit period.
 
#26
Antipodean
Super Member
  • Total Posts : 2059
  • Reward points : 0
  • Joined: 2008/12/09 10:19:08
  • Location: Didcot, United Kingdom
  • Status: offline
Re: High speed serial on PIC24EP128 2021/01/18 13:16:05 (permalink)
5 (2)

Monday, January 18, 2021 10:16 AM
CinziaG gave a 1 Star (-2) to your post titled:
"Re: High speed serial on PIC24EP128"

 
Oh dear, we strike again ... 
 

Do not use my alias in your message body when replying, your message will disappear ...

Alan
#27
MBedder
Circuit breaker
  • Total Posts : 6988
  • Reward points : 0
  • Joined: 2008/05/30 11:24:01
  • Location: Zelenograd, Russia
  • Status: offline
Re: High speed serial on PIC24EP128 2021/01/18 15:26:52 (permalink)
3.67 (3)
"Sleep pretty darling, do not cry
And I will sing a lullaby"©
 
I partially compensated your loss giving you 5 starsLoL
#28
JPortici
Super Member
  • Total Posts : 1333
  • Reward points : 0
  • Joined: 2012/11/17 06:27:45
  • Location: Grappaland
  • Status: online
Re: High speed serial on PIC24EP128 2021/01/18 23:34:22 (permalink)
4 (1)
If we can get over this pointless ratings...
updates? I'm really curious.
I do have a dsPIC33EV board hooked up, part of the datasheet says "17.5 Mbps" and part of it says "6.25 MBps", so i'm going to make a test today.. but i don't think how representative it will be since the 33EV is sure to have different IO circuitry thant the other PIC24E/dsPIC33E
#29
Antipodean
Super Member
  • Total Posts : 2059
  • Reward points : 0
  • Joined: 2008/12/09 10:19:08
  • Location: Didcot, United Kingdom
  • Status: offline
Re: High speed serial on PIC24EP128 2021/01/19 06:16:42 (permalink)
3 (2)
MBedder
"Sleep pretty darling, do not cry
And I will sing a lullaby"©
 
I partially compensated your loss giving you 5 starsLoL



Oh, thank you, most kind. 
 

Do not use my alias in your message body when replying, your message will disappear ...

Alan
#30
JPortici
Super Member
  • Total Posts : 1333
  • Reward points : 0
  • Joined: 2012/11/17 06:27:45
  • Location: Grappaland
  • Status: online
Re: High speed serial on PIC24EP128 2021/01/19 09:08:12 (permalink)
0
So, i did try the thing:
I hooked up the dsPIC33EV 5V CAN-LIN Starter Kit and wrote a simple program.
 
#include <xc.h>

// FSEC
#pragma config BWRP = OFF               // Boot Segment Write-Protect Bit (Boot Segment may be written)
#pragma config BSS = DISABLED           // Boot Segment Code-Protect Level bits (No Protection (other than BWRP))
#pragma config BSS2 = OFF               // Boot Segment Control Bit (No Boot Segment)
#pragma config GWRP = OFF               // General Segment Write-Protect Bit (General Segment may be written)
#pragma config GSS = DISABLED           // General Segment Code-Protect Level bits (No Protection (other than GWRP))
#pragma config CWRP = OFF               // Configuration Segment Write-Protect Bit (Configuration Segment may be written)
#pragma config CSS = DISABLED           // Configuration Segment Code-Protect Level bits (No Protection (other than CWRP))
#pragma config AIVTDIS = DISABLE        // Alternate Interrupt Vector Table Disable Bit  (Disable Alternate Vector Table)

// FBSLIM
#pragma config BSLIM = 0x1FFF           // Boot Segment Code Flash Page Address Limit Bits (Enter Hexadecimal value)

// FOSCSEL
#pragma config FNOSC = FRC              // Initial oscillator Source Selection Bits (Internal Fast RC (FRC))
#pragma config IESO = ON                // Two Speed Oscillator Start-Up Bit (Start up device with FRC,then automatically switch to user selected oscillator source)

// FOSC
#pragma config POSCMD = HS              // Primary Oscillator Mode Select Bits (HS Crystal Oscillator mode)
#pragma config OSCIOFNC = OFF           // OSC2 Pin I/O Function Enable Bit (OSC2 is clock output)
#pragma config IOL1WAY = ON             // Peripheral Pin Select Configuration Bit (Allow Only One reconfiguration)
#pragma config FCKSM = CSECME           // Clock Switching Mode Bits (Both Clock Switching and Fail-safe Clock Monitor are enabled)
#pragma config PLLKEN = ON              // PLL Lock Enable Bit (Clock switch to PLL source will wait until the PLL lock signal is valid)

// FWDT
#pragma config WDTPOST = PS32768        // Watchdog Timer Postscaler Bits (1:32,768)
#pragma config WDTPRE = PR128           // Watchdog Timer Prescaler Bit (1:128)
#pragma config FWDTEN = ON_SWDTEN       // Watchdog Timer Enable Bits (WDT Enabled/Disabled (controlled using SWDTEN bit))
#pragma config WINDIS = OFF             // Watchdog Timer Window Enable Bit (Watchdog timer in Non-Window Mode)
#pragma config WDTWIN = WIN25           // Watchdog Window Select Bits (WDT Window is 25% of WDT period)

// FPOR
#pragma config BOREN0 = ON              // Brown Out Reset Detection Bit (BOR is Enabled)

// FICD
#pragma config ICS = PGD2               // ICD Communication Channel Select Bits (Communicate on PGEC2 and PGED2)

// FDMTINTVL
#pragma config DMTIVTL = 0xFFFF         // Lower 16 Bits of 32 Bit DMT Window Interval (Enter Hexadecimal value)

// FDMTINTVH
#pragma config DMTIVTH = 0xFFFF         // Upper 16 Bits of 32 Bit DMT Window Interval (Enter Hexadecimal value)

// FDMTCNTL
#pragma config DMTCNTL = 0xFFFF         // Lower 16 Bits of 32 Bit DMT Instruction Count Time-Out Value (Enter Hexadecimal value)

// FDMTCNTH
#pragma config DMTCNTH = 0xFFFF         // Upper 16 Bits of 32 Bit DMT Instruction Count Time-Out Value (Enter Hexadecimal value)

// FDMT
#pragma config DMTEN = ENABLE           // Dead Man Timer Enable Bit (Dead Man Timer is Enabled and cannot be disabled by software)

// FDEVOPT
#pragma config PWMLOCK = ON             // PWM Lock Enable Bit (Certain PWM registers may only be written after key sequence)
#pragma config ALTI2C1 = OFF            // Alternate I2C1 Pins Selection Bit (I2C1 mapped to SDA1/SCL1 pins)

// FALTREG
#pragma config CTXT1 = NONE             // Interrupt Priority Level (IPL) Selection Bits For Alternate Working Register Set 1 (Not Assigned)
#pragma config CTXT2 = NONE             // Interrupt Priority Level (IPL) Selection Bits For Alternate Working Register Set 2 (Not Assigned)

void deviceInit(void) {
  RCONbits.SWDTEN = 0;

  //Oscillator Configuration: 140MHz. First, switch to FRC
  __builtin_write_OSCCONH(0);
  __builtin_write_OSCCONL(OSCCON | 0x01);
  //Wait for Clock switch to occur
  while(OSCCONbits.COSC != OSCCONbits.NOSC) {};
  //Set up the PLL
  CLKDIVbits.PLLPRE = 0;    //PLL Input Frequency = 8/2 = 4MHz
  PLLFBD = 68;              //PLL VCO Frequency = 4 * 70 = 280MHz
  CLKDIVbits.PLLPOST = 0;   //FOSC = 280 / 2 = 140MHz, 70 MIPS
  //Switch to PRI+PLL
  __builtin_write_OSCCONH(3);
  __builtin_write_OSCCONL(OSCCON | 0x01);
  //Wait for Clock switch to occur
  while(OSCCONbits.COSC != OSCCONbits.NOSC) {};

  //IO Init
  _TRISC4 = 0;

  _LATB7 = 1;
  _TRISB7 = 0;
  _RP39R = 1;
  _ANSB8 = 0;
  _TRISB8 = 1;
  _U1RXR = 40;

  //UART Init
  U1MODEbits.UARTEN = 1;  //Enable UART

  U1MODEbits.IREN = 0;    //Disable IRDA Encoder/Decoder
  U1MODEbits.RTSMD = 0;   //Simplex Mode
  U1MODEbits.UEN = 0;     //Ignore flow control pins
  U1MODEbits.WAKE = 0;    //Ignore WakeUp
  U1MODEbits.LPBACK = 0;  //Disable Loopback
  U1MODEbits.ABAUD = 0;   //Disable Auto Baude Generator
  U1MODEbits.URXINV = 0;  //Idle state is 1
  U1MODEbits.BRGH = 1;    //High Speed BRG mode
  U1MODEbits.PDSEL = 0;   //8 bit, no parity
  U1MODEbits.STSEL = 0;   //1 stop bit

  U1STAbits.UTXISEL1 = 0;
  U1STAbits.UTXISEL0 = 0; //Interrupt when a character has been put in the transmit shift register
  U1STAbits.UTXINV = 0;   //Idle state is 1
  U1STAbits.UTXEN = 1;
  U1STAbits.URXISEL = 0;  //Interrupt when at least a character has been received
  U1STAbits.ADDEN = 0;    //Disable Address detection

  U1BRG = 0;              //Fastest Speed
}

int main(void) {
  volatile unsigned int idx;
  char datatx,data;
  deviceInit();

  while(1) {
    U1TXREG = datatx;
    while(!U1STAbits.TRMT);

    while(!U1STAbits.URXDA);
    data = U1RXREG;

    while(U1STAbits.URXDA) {U1RXREG;}

    if (data != datatx) {
      _LATC4 = 1;
    }
    else {
      _LATC4 = 0;
    }

    datatx++;

    for (idx=0;idx<60000;idx++) {
      Nop();
    }
  }
}

 
Only other thing to do is connect RB7 and RB8, which i did with a 15cm jumper cable.
Basically, the leftmost user LED lights up if the received data doesn't match the transmitted data.
The led was never lit.
 
Yes, it's a dsPIC33EV256GM106, which has a clearly different IO circuitry than the PIC24EP128GP204 (the 33EV supports 5V IO and has a restricted VDD range of 4.5-5.5V) but here are some considerations.
The Datasheet claims 17.5 Mbps, The Electrical characteristics claim 6.25 Mbps, However
- The Max Output RISE/FALL time is 10ns, so in theory the UART performance is not limited by the IO
- The waveform were probed correctly at the source and at the destination, so the RB7 and RB8 pin with the spring at the nearest GND point. I don't have screenshots but they are what you would expect, some damped ringing at the source and some ringing at the destination due to impedance mismatches along the line so that is not a limitating factor either
 
I was kinda expecting the waveform to be correct but the data to be wrong, due to some other internal limitations (otherwise why have different speed grades for the SPI with dedicated pins?)
 
Could it be that the limitation is not in the IO or the peripheral, but somewhere else? perhaps the data bus can't get the data from the peripheral fast enough? I'm thinking this as i'm writing.. I did put some space between characters so i could catch something with the scope and all ran smoothly.
#31
NorthGuy
Super Member
  • Total Posts : 6597
  • Reward points : 0
  • Joined: 2014/02/23 14:23:23
  • Location: Northern Canada
  • Status: offline
Re: High speed serial on PIC24EP128 2021/01/19 15:29:24 (permalink)
2 (1)
Jack_M
Only other thing to do is connect RB7 and RB8, which i did with a 15cm jumper cable.
Basically, the leftmost user LED lights up if the received data doesn't match the transmitted data.
The led was never lit.

 
The biggest danger with UART (compared to source synchronous SPI) is that sender's and receiver's clock speeds are not exact same frequency. The clock gets synchronized at the start of the symbol then they get dissynchronized by the 10-th (stop) bit. With the duration of the baud of 60 ns and rise and fall times around 30 ns, you will have perhaps 10-20 ns sampling window compared to 600 ns duration of the byte, this might be 10/600 = 1.6%. If you divide this equally between sender and receiver, this is 0.8% of clock accuracy.
 
If you build 100 devices, of which 90 meet 0.8% requirement, but 10 don't, the design is a disaster, but you may not see the problem if you only test 5-10 devices. That's why UART clock must have certain accuracy by design. Most likely, an external crystal (or oscillator) is required.
 
Of course, if you test with the same PIC, the clock matches exactly.
#32
Antipodean
Super Member
  • Total Posts : 2059
  • Reward points : 0
  • Joined: 2008/12/09 10:19:08
  • Location: Didcot, United Kingdom
  • Status: offline
Re: High speed serial on PIC24EP128 2021/01/21 16:38:09 (permalink)
3 (2)

Thursday, January 21, 2021 11:09 AM
CinziaG gave a 1 Star (-2) to your post titled:
"Re: High speed serial on PIC24EP128"

 
I don't know what the object of this activity is, bit it is stupid on the part of CinziaG.
 

Do not use my alias in your message body when replying, your message will disappear ...

Alan
#33
dan1138
Super Member
  • Total Posts : 4330
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re: High speed serial on PIC24EP128 2021/01/21 18:13:21 (permalink)
3 (1)
Anti-podean

Thursday, January 21, 2021 11:09 AM
CinziaG gave a 1 Star (-2) to your post titled:
"Re: High speed serial on PIC24EP128"

I don't know what the object of this activity is, bit it is stupid on the part of CinziaG.

Stupidity like entropy has no upper bound.
#34
Antipodean
Super Member
  • Total Posts : 2059
  • Reward points : 0
  • Joined: 2008/12/09 10:19:08
  • Location: Didcot, United Kingdom
  • Status: offline
Re: High speed serial on PIC24EP128 2021/01/29 12:20:54 (permalink)
3 (2)

Friday, January 29, 2021 11:56 AM
CinziaG gave a 1 Star (-2) to your post titled:
"Re: High speed serial on PIC24EP128"
Your post is located at:
https://www.microchip.com/forums/FindPost/1163960

 
Two in one day, my good ness. The other on eos over here ... https://www.microchip.com/forums/FindPost/1164358
Still got nothing else to do CinziaG ???
 

Do not use my alias in your message body when replying, your message will disappear ...

Alan
#35
Page: < 12 Showing page 2 of 2
Jump to:
© 2021 APG vNext Commercial Version 4.5