UART2_INIT initialisation issue 18F27K42

Beta Testing discussion on mikroPascal PRO for PIC.
Post Reply
Author
Message
jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

UART2_INIT initialisation issue 18F27K42

#1 Post by jpc » 01 Apr 2019 19:32

I found the UART2_INIT to set the TRISB2_bit , i do not see any reason for this so suppose it to be by accident
Au royaume des aveugles, les borgnes sont rois.

jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

Re: UART2_INIT initialisation issue 18F27K42

#2 Post by jpc » 02 Apr 2019 12:11

it turns out this function starts calling __Lib_UART_Remappable_K42_83_UART2_MapDefaultPins , as far as i see in the datasheet there is a default RX1 and RX2 pin however the TX1 and TX2 both need remapping, the setting of RB2 as input makes no sense here, what btw would be the Default pins to which this function would map the RX and TX pins?
Au royaume des aveugles, les borgnes sont rois.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: UART2_INIT initialisation issue 18F27K42

#3 Post by filip » 03 Apr 2019 14:17

Hi,

Yes, UART2_Init is set to RB5(Tx) and RB2(Rx) pins by default, I will see with the developers about the choice of pins.

On the other hand, you can remap the UART to pins of our choice using the PPS library (using the datasheet for reference).

Regards,
Filip.

jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

Re: UART2_INIT initialisation issue 18F27K42

#4 Post by jpc » 03 Apr 2019 14:49

Filip,

thanks for the reply , i had figured out these pin assignments in between ( took me a while as i used them for something else) , do not think this is a convenient solution though, there is a default RX2 on RB7 according to the datasheet, to me it would seem logical to leave that at least in place and in analogy with UART1 RB6 would be the most logical default TX2, I failed to do so until now as there must be issues with the devicefile, i cannot find _TX2_CK2 or it's equivalent yet.
Au royaume des aveugles, les borgnes sont rois.

jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

Re: UART2_INIT initialisation issue 18F27K42

#5 Post by jpc » 04 Apr 2019 16:10

ok, worked out the direct PPS configuration, by using the Uartx_remappable_init and writing directly into the appropriate PPS registers it all works ok , i noticed this is the way to go as the PPS library wastes a horrible amount of ROM ( not far from 1K5 !)
Perhaps you should focus on explaining how to configure PPS in general directly ( possibly provide some predefined constants) and forget about these memory-wasting libraries.
Au royaume des aveugles, les borgnes sont rois.

Post Reply

Return to “mikroPascal PRO for PIC Beta Testing”