UART interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UART interrupt

1,071 Views
Alex_2221
Contributor IV

Hello everyone, I working on a project with LPC1768. I'm reading 2 temperatures from 2 sensors and send them two a phone via bluetooth continuously. Now I want to add interrupt in order to send 2 digit numbers to the board via bluetooth and echo back the numbers, while continuously sending the 2 temperatures to them phone. When I wanted to activate interrupt and I added the two lines below:

UART_IntConfig(LPC_UART3, UART_INTCFG_RBR,ENABLE);
NVIC_EnableIRQ(UART3_IRQn);

My board only sent the temperature 3-4 and stopped communication with my phone. What I'm doing wrong?

I added my main code below also I attached the main.c and Hardware.c ( configurations where I activate the interrupt).

 Thanks in advance, 

  Alex

main code :

#include <stdio.h>

#include "lpc17xx_gpio.h"
#include "lpc17xx_pinsel.h"
#include "lpc17XX_uart.h"
#include "lpc17XX_adc.h"

#include "Hardware.h"
#include "Delay_RIT.h"

//void UART_IntReceive(void)
//{
// uint8_t data= UART_ReceiveByte(LPC_UART3);
// UART_SendByte(LPC_UART3,data);
//
//
//}

int main()
{
uint8_t buffstr [20];
//uint8_t buffstr2 [20];

// uint8_t setTemp [1];

// GPIO_SetDir(2,(1<<0),1);

HW_Init();

while(1)
{
uint16_t temp1 = HW_ADC_Read1();
uint16_t temp2 = HW_ADC_Read2();


uint8_t len= sprintf( (char*)buffstr," %u\n %u\n ",temp1,temp2);
UART_Send(LPC_UART3,buffstr,len,NONE_BLOCKING);

Delay_RIT_ms(1000);


}

}

 

 

0 Kudos
5 Replies

1,035 Views
Alex_2221
Contributor IV

@xiangjun_rong  What's your opinion?

0 Kudos

1,051 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Alex,

Please check whether there is UART receive interrupt after your phone send 5-6 numbers.

 

BR

Alice

0 Kudos

1,041 Views
Alex_2221
Contributor IV

Thanks I'll check that, but actually my phone should receive data from the board continuously, not sending them 5-6 times

0 Kudos

1,026 Views
frank_m
Senior Contributor III

I don't think this is the right way to tackle your problem.

Split your problem up in small sub-units you can easily observe.

I.e. check the serial communication to the attached BT module (if I got that right), and see if it matches your expectations. You can involve the smartphone later if you know that works.

You might need a scope for that - and the debugger of course.

0 Kudos

1,019 Views
Alex_2221
Contributor IV

Yeah a scope and a debuger would help, but have been working on this project for some time and can't figure out what the problem is I can echo back data sometimes, but can't read the temperatures continously. Thank you

0 Kudos