UART Comm Code no longer works with Pascal Pro 4.0

General discussion on mikroPascal PRO for PIC32.
Post Reply
Author
Message
Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

UART Comm Code no longer works with Pascal Pro 4.0

#1 Post by Rotary_Ed » 17 Nov 2017 18:22

As I continue checking my program after compiling with Pascal Pro 4.0, I find that my UART code to communicate with two external systems no longer works. No idea why not. Went back to Pascal Pro 3.6 and that identical source code compiles and works.
Must say that makes me a bit leery of what else I may find once (if) I can figure out why this problem.

Anyone else having a similar problem?
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: UART Comm Code no longer works with Pascal Pro 4.0

#2 Post by Rotary_Ed » 19 Nov 2017 21:25

I have continued to dig into why my UART comm function no longer work using Version 4.0 of the pascal pro compiler.
It appears that the module no longer functions to transmit the characters placed in the UART2_Write() or UART5_Write() modules

I have a somewhat simple Rs232 monitor on my computer and it clearly show the difference in the output of the UARTX module between the code compiled with 3.6.0 verse that compiled with version 4.0.

The bottom image shows the data as it should be transmitted to an external device which then decodes the commands and replies. The top image shows the output after compiling with Pascal Pro 4.0. Just a series of FF and FE which are invalid. I have even taken the UART2_Write() library routine alone and attempt to transmit a character with the same results - this would seem to indicate (as well as my code working with the 3.6.0 compiler) that the problem is not in my code. But, I can not show that for certain.

I suspect the problem could be in the UART initiation sequence, but have no way of knowing.

So if any one is using a PIC32MX795F512H/L chip and the UARTx_Init_Advance initiational routine, I would appreciate hearing from you.

Thanks
Version 4.0 UART_2 TX Output.jpg
Version 4.0 UART_2 TX Output.jpg (50.99 KiB) Viewed 2426 times
Version 3.6.0 UART_2 TX Output.jpg
Version 3.6.0 UART_2 TX Output.jpg (47.96 KiB) Viewed 2426 times
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: UART Comm Code no longer works with Pascal Pro 4.0

#3 Post by Rotary_Ed » 20 Nov 2017 15:54

:D I Have finally gotten the UART models to work with Compiler 4.0. The problem I am having apparently resides in the module's advanced initialization routines. Posting this in case someone may be having a similar problem.

Here is the code I use for UART2 and UART5 modules for over two years that works with all Pascal Pro PIC32compilers up to and including compiler 3.6.0. However, this initialization does not work for my project with compiler 4.0. There is no error indication when compiled - just does not work.

Code: Select all

 
UART2_Init_Advanced(9600,24000 ,_UART_LOW_SPEED, _UART_8BIT_NOPARITY, _UART_ONE_STOPBIT);   // 11 July 2015    
UART_Set_Active(@UART2_Read, @UART2_Write, @UART2_Data_Ready, @UART2_Tx_Idle); // set UART2 active

UART5_Init_Advanced(9600,24000 ,_UART_LOW_SPEED, _UART_8BIT_NOPARITY, _UART_ONE_STOPBIT);  // 11 July 2015
UART_Set_Active(@UART5_Read, @UART5_Write, @UART5_Data_Ready, @UART5_Tx_Idle); // set UART5 active
  
   
After some experimenting I tried this simple initialization

Code: Select all

 UART2_Init(9600);   // 20 Nov 2017

 UART5_Init(9600);   // 20 Nov 2017
This initialization works in 4.0.

I can not determine why my original code works with 3.6.0 but not 4.0. But, it looks like the simpler UART initialization routine works for me in 4.0, so onward! :)
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

Rotary_Ed
Posts: 756
Joined: 26 Dec 2004 23:10
Location: Matthews, NC, USA
Contact:

Re: UART Comm Code no longer works with Pascal Pro 4.0

#4 Post by Rotary_Ed » 04 Dec 2017 16:25

Hi Lana,

Tested the UART code you sent compiled with 4.0 and loaded to my Fusion V7 board. Both channels USB-UART worked, two way communication over both UART2 and UART5 chip modules :D . Since your code used the advanced initialization and worked, I conclude the problem has to be in my code :? . So thanks, I will keep working on my code to find out where the problem lies.

Thanks again
Rotary_Ed
Matthews, NC USA
Rv-6A N494BW Rotary Powered

Post Reply

Return to “mikroPascal PRO for PIC32 General”