Rx interrupt not working

Hi All,

I am using an R32C/118 micro processor (R5F64189). I am trying to use UART7 to work as the hardware layer for my modbus module.

Here is my initialisation sequence:

P15_0S                =        0x03; // set p15_0 as uart TX

P15_2S                =        0x00; // p15_2 is initially just a general IO

IFS0_bit.IFS05     =        0x01; // Use p15 for UART7 and set P15_2 as UART RX

PD15_bit.PD15_0 =        0x01; // Set transmit pin as output

PD15_bit.PD15_2 =        0x00; // Set receive pin as input

PD12_bit.P12_6   =         0x01; // This is my direction switch pin for 2- wire RS485, set as output here

U7MR                 =          0x15;

U7C0                  =          0x18;

U7C1                  =          0x02;

U78CON             =          0x01;

S7RIC                 =          0x01;

S7TIC                 =           0X01;

U7BRG               =           12; // Baudrate of 115200 for 24 kHz

U7MR_bit.PRYE  =           0x00;

U7C1_bit.TE        =           0x00; // these two bits are flipped in my transmit and receive functions.

U7C1_bit.RE        =           0x01;       

My problem is that my receiving device receives the modbus commands okay and it replies with a valid modbus command which is reaching the UART RX pin of the processor (I can see bot the RX and TX messages in my scope). But my break point in the receive interrupt is not being hit. My receive interrupt vector is UART7_RX.

When I checked the S7RIC_bit.IR bit after setting the ports to receive mode (after sending a modbus command through my transmit function), I noticed that this bit is not changing its state to 1, which is why it is not entering my RX interupt service routine? But what am I missing? I cant see anything obviously wrong in the code.

Please help!

Kind regards,

Pillasaar

Parents
  • Got it working finally!!

    The problem was that I am using the 144 pin package and for enabling ports 11 to 15, you have to set the PCE bit in PCR (port control register).

    And this is mentioned only in one page in the whole of the manual. I would expect a foot note in the uart section saying I can use uart in port 15 only if I have set this bit.

    I wonder why the TX was working though!

Reply
  • Got it working finally!!

    The problem was that I am using the 144 pin package and for enabling ports 11 to 15, you have to set the PCE bit in PCR (port control register).

    And this is mentioned only in one page in the whole of the manual. I would expect a foot note in the uart section saying I can use uart in port 15 only if I have set this bit.

    I wonder why the TX was working though!

Children
No Data