Author Topic: how to use the TXPPS register of the PIC16F18323?  (Read 2519 times)

0 Members and 1 Guest are viewing this topic.

Offline FrankBussTopic starter

  • Supporter
  • ****
  • Posts: 2365
  • Country: de
    • Frank Buss
how to use the TXPPS register of the PIC16F18323?
« on: December 26, 2017, 11:49:57 pm »
In this datasheet:

http://ww1.microchip.com/downloads/en/DeviceDoc/40001799C.pdf

I can see the TXPPS register in table 4-4 on page 40, and I assume this can be used to select which output pin has the TX signal of the UART. But I can't find a description of the register.
« Last Edit: December 28, 2017, 06:06:24 pm by FrankBuss »
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Offline hexreader

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: england
Re: how to use the TXPPS register of the PIC18F18323?
« Reply #1 on: December 26, 2017, 11:58:35 pm »
Page 144 section 13.8

.... maybe ....

Will keep reading.....

EDIT :  on second thoughts...  maybe page 145 register 13-2

I see the problem, the datasheet is really hard to interpret. I have a suspicion that there is an error in the datasheet somewhere, but can't quite work it out.

Table 3-1 does not even mention TXPPS :(

EDIT2 :  TX/CK output seems to have something to do with a mysterious and magical 'OUT' pin. I do not have that PIC to try the different options. Maybe post this question on the Microchip forum. The experts mostly reside there. It is currently beyond my understanding 
« Last Edit: December 27, 2017, 12:33:44 am by hexreader »
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13695
  • Country: gb
    • Mike's Electric Stuff
Re: how to use the TXPPS register of the PIC18F18323?
« Reply #2 on: December 27, 2017, 12:00:36 am »
I wonder if that is a misprint - the way PPS on most PICs works is that for outputs, you set the <pinname>PPS to the required peripheral source, and for inputs, you use < peripheralfunction>PPS, e.g. RXPPS to select which port/pin to get that signal from, so you wouldn't have an output peripheral function with a PPS.
Some chips may be different
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 
The following users thanked this post: JPortici

Offline hexreader

  • Frequent Contributor
  • **
  • Posts: 260
  • Country: england
Re: how to use the TXPPS register of the PIC18F18323?
« Reply #3 on: December 27, 2017, 01:48:53 am »
I even tried MCC (Microchip Code Configurator) for PIC16F18323 and XC8. I ended up more confused than ever when examining the .c and .h files generated :(

By the way, I think you mis-typed the title of this thread. I think you mean PIC16F18323, not PIC18F18323.
 

Offline cv007

  • Frequent Contributor
  • **
  • Posts: 822
Re: how to use the TXPPS register of the PIC18F18323?
« Reply #4 on: December 27, 2017, 01:55:22 am »
The TX out pin is also CK in, so they have a PPS in register named TXPPS-makes sense, right? why name it CKPPS? :)  The register is in the header file, but its confusing when they name the output function as the input name, I've run into this on 16f (I think they also sometimes combine like TXCK, gets confusing).

Now, to come up with an output source selection, since the datasheet does not list TX/CK, there are 11 reserved of the 31 available to try (they list 00000 as reserved, but that has to be LATxx, so they have more than one datasheet problem). Maybe they have a similar 18f with a datasheet that works.

In the RxyPPS register, put the number of the peripheral output you want in there (0-31, 0 means use LAT). Fire up the TX spitting out something, try the 31 combos in RxyPPS, when you see something you hit the target.
« Last Edit: December 27, 2017, 06:50:54 am by cv007 »
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3137
  • Country: ca
Re: how to use the TXPPS register of the PIC18F18323?
« Reply #5 on: December 27, 2017, 05:10:02 am »
There are two pins. For the asynchronous (UART) mode they're TX and RX. For synchronous mode they are CK and DT.

With normal UART, TX is output only, so to set it, you set the pi's RxyPPS pin to this value:

"10100  = Rxy source is EUSART TC/CK" (sic! - TX is misspelled as TC in my datasheet.

It is different if you want synchronous mode. TX/CK pin might be an input. That's where TXPPS is used, which, in truth, is actually CKPPS.
 

Offline FrankBussTopic starter

  • Supporter
  • ****
  • Posts: 2365
  • Country: de
    • Frank Buss
Re: how to use the TXPPS register of the PIC18F18323?
« Reply #6 on: January 04, 2018, 07:21:07 am »
The TX out pin is also CK in, so they have a PPS in register named TXPPS-makes sense, right? why name it CKPPS? :)  The register is in the header file, but its confusing when they name the output function as the input name, I've run into this on 16f (I think they also sometimes combine like TXCK, gets confusing).

Right, I asked the Microchip support about it to be sure. And the TXPPS register is the xxxPPS register, and only if the UART is in slave mode for synchronous data transfers. Then it is used as the CK input. Quote from the support:

Quote
Please see Section 31.4.1.6 Slave Clock on page 360 of the datasheet (http://ww1.microchip.com/downloads/en/DeviceDoc/PIC16(L)F1831318323%20Full%20Featured%20Low%20Pin%20Count%20Microcontrollers%20with%20XLP_40001799D.pdf).
TX/CK is input when the device is slave mode in synchronous data transfers.

Please see Section 13.1 PPS Inputs on page 142 of the datasheet.
Note says "The notations "xxx" in the register name is a place holder for the peripheral identifier. For example, CLC1PPS."
This includes what you are inquiring which is TXPPS.

Please see Register 13-1: xxxPPS on page 144 of the datasheet.
Which pin are you going to assign TX/CK when your device is in slave mode during synchronous data transfer? If you want it on RC5, have TXPPS = 0b10101; on your initialization code for EUSART1 (pages 346 to 370 of the datasheet).

Looks like they don't think it is difficult to figure it out, but I still feel like solving a crossword puzzle :-//

These PPS and CLC features are really nice, but I wonder if it wouldn't be simpler and more flexible to just integrate a small CPLD in it instead of configuring lots of registers, and then program it in VHDL. I guess such a chip would be the only CPLD with 5V output, all other 5V CPLDs are discontinued. Had to think a bit how to use the fixed AND/OR combination with the inverter and GND settings to implement a given function with it, I'm a bit rusty in Karnaugh maps etc.
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3137
  • Country: ca
Re: how to use the TXPPS register of the PIC18F18323?
« Reply #7 on: January 04, 2018, 03:45:32 pm »
Looks like they don't think it is difficult to figure it out, but I still feel like solving a crossword puzzle :-//

It is not so puzzling if you think of the PPS as a MUX controlled by the xxxPPS register. The MUX has many inputs and only one output. The register controls which of the inputs is connected to the output.

The output of the PPS MUX can either drive an output pin (in which case the PPS register belongs to the output pin) or an input of a peripheral module (in which case the PPS register belongs to the input of the module). Input pins or peripheral outputs cannot be driven by the PPS MUX, hence they cannot have PPS registers.

Bidirectional points are a little bit more difficuit. They're driven by the PPS MUX, but at the same time they provide an output, which can serve as an input to another PPS MUX. So, if you want something bidirectional, you need to set up two PPS MUXes - two different PPS registers.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf