Hello guys, I'm back with another issue related to PIC18F97J60 and serial ports.
Even if the good Mister-e pointed out and actually solved the issue of HSERIN2 not working at all for that chip, seems that there is something still weird there.

Explanation:
- In order to understand if there is a byte into the port1 buffer, I poll PIR1.5 byte;
- if found it set to 1, it means there is a character. Then start HSERIN. I don't care the first character since there are 3 characters as preamble;
- If a character is found, the do some process and write outside with HSEROUT
- If no data, I'll check the register PIR3.5 to know if a character is in the buffer for the port 2.
- the same as before, if there is one immediately start HSERIN2 then some process and write outside with HSEROUT2.

Well, anything is working BUT the code that deal with HSERIN, it work only ONCE. I've tried MANY times even with a digital scope. Data are really coming to the Port 1 but the PIR1.5 is everytime 0.
I've figured out that maybe need to toggle the CREN bit. Nothing to do.
Instead the bit PIR3.5 is still working very well and all the time.
I've also putted a LED (named LED_48VFault in the code) to see WHEN the code after the checking of PIR1.5 is executed.
Since the high timeout on HSERIN (200ms) I'm able to see it flashing when it execute.
The problem is that it execute just ONCE. The first time that I send some command to the Port1, it flash and anything is working. Since the second time, no more working but the Port2 it work regularly and as expected.

Below is the code:

Code:
Include "modedefs.bas"          'Inline compiler's pre-defined constants
define OSC 25                   'Set the Crystal Clock speed

define HSER_CLROERR 1            'No Error Overflow on Serial Port 1
define HSER2_CLROERR 1          'No Error Overflow on Serial Port 2

ADCON0 = 0                      'AD converter module 0 = disabled
ADCON1 = %00001111              'Set all analog pins to digital
ADCON2 = %00000000
CMCON  = %00000111              'Comparator = disabled
INTCON = %00111000
INTCON2 = %10000000
INTCON3 = %00000000
RCON.7 = %00000000
T0CON  = %00000000              'Timer0 disabled (see page 163)
T1CON  = %00000000              'Timer1 disabled (see page 167)
T2CON  = %00000000              'Timer2 disabled (see page 173)
T3CON  = %00000000              'Timer3 disabled (see page 175)
T4CON  = %00000000              'Timer4 disabled (see page 179)
CCP4CON = %00000000             'Capture/Compare/PWM 4 disabled (see page 181)
CCP5CON = %00000000             'Capture/Compare/PWM 5 disabled (see page 181)
CCP1CON = %00000000             'Capture/Compare/PWM 1 disabled (see page 189)
CCP2CON = %00000000             'Capture/Compare/PWM 2 disabled (see page 181)
CCP3CON = %00000000             'Capture/Compare/PWM 3 disabled (see page 181)
EECON2.5 = 0                    'Ethernet Module Disabled


SSP1CON1.5 = 0                   'Disable SPI 1 and set pins as GPIO
SSP2CON1.5 = 0                   'Disable SPI 2 and set pins as GPIO

BAUDCON1 = %00001000             'BRG16=1; See page 304
BAUDCON2 = %00001000

                                        'Serial Port 1 speed setting:
SPBRGH1 = $00                    '115200 bps for serial port 1 =53 ($35)
SPBRG1  = $35

                                 'Serial Port 2 speed setting:
SPBRGH2 = $00                    '115200 bps for serial port 2 =53 ($35)
SPBRG2  = $35

TXSTA1 = %00100100               'Tx1 enabled,8bit,Async, see page 302
RCSTA1 = %10010000               'Rx1 enabled,8 bit,Async,No frame&overfl.err
                                 'See page 303

TXSTA2 = %00100100               'Tx2 enabled,8bit,Async,Hi-speed see page 302
RCSTA2 = %10010000               'Rx2 enabled,8 bit,Async,Hi-Speed
                                 'No frame&overfl.err (See page 303)

            
'Port D features setting:
PSPCON.4 = 0                    'Port D set to be used as GPIO

TRISG.0 = 0                     
TRISG.1 = 0                     'PortG1 = Output (External RS232-TX2)
TRISG.2 = 1                     'PortG2 = Input  (External RS232-RX2)
TRISG.3 = 0                     
TRISG.4 = 1                     
TRISG.5 = 1                     
TRISG.6 = 1                     
TRISG.7 = 1                     
LATG = 0

syncByte        var byte
ADDRByte       var byte
CmdType        var byte
CmdID            var byte
preamble         var byte
PortAddr         var byte
LED_SysAlive   var PORTJ.0
LED_48VFault   var PORTJ.1

MainLoop:
    LED_SysAlive =  ~ Led_SysAlive 'Blink a led as fast is possible
    Gosub ReadPort1
    Gosub ReadPort2
    Goto MainLoop

ReadPort1:        
    'The following lines are commented because do not produce any visible results.
    'if RCSTA1.1=1 then
        'RCSTA1.4=0
        'RCSTA1.4=1
    'endif
    'RCSTA1 = %10010000

        
    IF PIR1.5 = 1 then         'Data ready on Port1:
        PortAddr = 1
preamble1:
        LED_48VFault  = 1
        hserin 200, NoData1,[syncByte]      
        if syncByte = "-" then 
            goto preamble1
        endif
        IF syncByte = "U" then        
            hserin 200, NoData1,[ADDRByte]    'Expect the address of the Unit
            IF ADDRByte = 1 Then
                'Data stream start coming now to this unit
                hserin 200, NoData1,[CmdType, CmdID, preamble]
                Select Case CmdID
                       Case = 1
                            'Do something
                             Gosub Answer
                       Case = 2
                            'Do something else
                            Gosub Answer
                End Select
           End IF
        End IF
    End IF

NoData1:
    syncByte = 0
    CmdType = 0
    LED_48VFault = 0
    Return


ReadPort2:        
    IF PIR3.5 = 1 then         'Data ready on Port2:
        PortAddr = 2
preamble2:    
        hserin2 200, NoData2,[syncByte]      
        if syncByte = "-" then 
            goto preamble2
        endif
        IF syncByte = "U" then        
            hserin2 200, NoData2,[ADDRByte]    'Expect the address of the Unit
            IF ADDRByte = 1 Then
                'Data stream start coming now to this unit
                hserin2 200, NoData2,[CmdType, CmdID, preamble]
                Select Case CmdID
                       Case = 1
                            'Do something
                             Gosub Answer
                       Case = 2
                            'Do something else
                            Gosub Answer
                End Select
           End IF
        End IF
    End IF

NoData2:
    syncByte = 0
    CmdType = 0
    Return

Answer:
    IF PortAddr = 1 Then
          HSEROUT ["U", 1, CmdType, CmdID] 
    Else
          HSEROUT2 ["U", 1, CmdType, CmdID]
    End IF
    Return
Some clue?

Thank you very much to all