AnsweredAssumed Answered

Serial_LDD - impossible to receive characters

Question asked by Remi Beges Employee on Aug 14, 2015
Latest reply on Aug 17, 2015 by Remi Beges

I cannot seem to get the Serial_LDD module to receive any characters.

 

What bothers me is that I've set a breakpoint in the Event.c onBlockReceive interrupt, but the program NEVER reaches it. I have tried arduino console, putty, python for sending serial characters, checked the serial port a hundred times, doesn't seem related to the computer.

 

Main.c:

/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/

  PE_low_level_init();

  /*** End of Processor Expert internal initialization.                    ***/

 

 

  /* Write your code here */

  /* For example: for(;;) { } */

  set_serial_state(FALSE);

  uint8_t data[10];

  AS1_ReceiveBlock(AS1_DeviceData, data, 1);

 

  for(;;)

  {

        if(get_serial_state())

        {

             // Send it back

             AS1_SendBlock(AS1_DeviceData, data, 1);

             set_serial_state(FALSE);

        }

  }

 

 

functions.h

 

#ifndef SOURCES_FUNCTIONS_H_

#define SOURCES_FUNCTIONS_H_

 

#include "PE_Types.h"

 

extern bool serial_rx_state;

 

void set_serial_state(bool state);

bool get_serial_state();

 

#endif /* SOURCES_FUNCTIONS_H_ */

 

 

functions.c

 

bool serial_rx_state;

 

void set_serial_state(bool state)

{

  serial_rx_state = state;

}

 

bool get_serial_state()

{

  return serial_rx_state;

}

 

And the interrupt in Events.c

 

void AS1_OnBlockReceived(LDD_TUserData *UserDataPtr)

{

/* Write your code here ... */

  set_serial_state(TRUE);

}

 

 

 

If somebody can hint me why it's not working, I would appreciate it because I'm completely stuck. I'm just stunned that this simple code won't simply work. I'm using KDS 3.00 and KL26Z

BTW the documentation of the serial_ldd component seems out of date, it is referring to a ProcessorExpert.c file, but I cannot find this file anywhere in the hierarchy.

 

PS : No block code in this online editor ??

 

EDIT : I cannot even send characters now

 

Main .c

 

* Write your code here */

  /* For example: for(;;) { } */

  set_serial_state(FALSE);

  uint8_t data[10];

 

  AS1_ReceiveBlock(AS1_DeviceData, data, 1);

  uint32_t i = 0;

 

while(1)

  {

   if(i >= 10000)

   {

   data[0] = "o";

   data[1] = "k";

   AS1_SendBlock(AS1_DeviceData, data, 2);

   i = 0;

   }

   else

   i++;

  }

 

 

I receive strictly nothing. Also checked speed (9600 bauds), same on both sides. This is starting to be very frustrating

Outcomes