Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

Connecting the Altera UART port to a development kits uart port

Hi I am working on a bluetooth(BT) development kit. The BT kit has a RS232 serial interface. I program the BT IC using hyperterminal [AT commands]. Now I need to connect the altera stratix ep1s10f780c6 kit's UART/RS-232 to the board directly. I wrote a small code to make a bluetooth connection. However nothing seems to be happening. Can someone assist me regarding this problem? Thanks

# include <stdio.h>

# include <string.h>

int main()

{

FILE* fp;

char prompt=0;

fp = fopen("/dev/uart1", "w+");

fprintf(fp,"AT+BTW0021D226A29E\r\n");

while(1){

prompt = getc(fp);

printf("%c", prompt);

}

fclose(fp);

return 0;

}

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    • check the return value of the fopen call, just to be sure that it was opened correctly

    • you will only see the result of the printf after a line feed character. To begin with you should print a full line for each character received, just to check if anything is there

    • did you check the UART speed, number of bits and parity settings in SOPC builder?

    • can you use an oscilloscope to see if anything is happening on the serial link?

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I forgot to mention that the code works perfectly fine when connected to PC [using serial port] .. I can see the data being displayed on hyperterminal..and also i can type data from the hyperterminal.. however i cannot see the data when i plug my serial port into the bluetooth dev kit.. the development kit also is programmed using a rs232 port.. so i just replaced the pc with bluetooth dev kit.

    altera ----> PC

    bluetooth kit ------> PC

    required connection

    bluetooth kit ------> altera