problem with readByteEvent in wsndemo

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi.....
i use wsndemo with atmega128rfa1...
in c# i write this code to send data over the rs232 to atmega128rfa1..:
serialPort1.WriteLine(txtsend.Text);

and my usartDescriptor configuration like this:
void appStartUsartManager(void)
{
usartDescriptor.tty = USART_CHANNEL;
usartDescriptor.mode = USART_MODE_ASYNC;
usartDescriptor.flowControl = USART_FLOW_CONTROL_NONE;
usartDescriptor.baudrate = USART_SPEED;
usartDescriptor.dataLength = USART_DATA8;
usartDescriptor.parity = USART_PARITY_NONE;
usartDescriptor.stopbits = USART_STOPBIT_1;
usartDescriptor.rxBuffer = rxBuffer;
usartDescriptor.rxBufferLength = USART_RX_BUFFER_LENGTH;
usartDescriptor.txBuffer = NULL;
usartDescriptor.txBufferLength = 0;
usartDescriptor.rxCallback = readByteEvent;
usartDescriptor.txCallback = writeConfirm;

OPEN_USART(&usartDescriptor);

memset(&wsn2usart, 0, sizeof(wsn2usart));
wsn2usart.isFreeUsart = true;
}

but i dont know why in wsndemo app in file wsnuartmanager.c this function
static void readByteEvent(uint16_t readBytesLen);
is not start!!

please guide me how i can fix this?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Have you tried asking this question on any of the C# (C_Sharp?) web forums?

Does the standard C# 'init_USART' function return a value? Can you send data out of the PC serial port and see it on an oscilloscope?

How do you know that the function readByteEvent() "is not start"? How can you tell that the PC is getting the correct serial data that would trigger a ReadByteEvent? Does ReadByteEvent() expect to be called by the main code and return the data in the USART buffer (or NULL if there is no data), or does it wait in the background and only return data when an serial port event occurs? What happens to the data ReadByteEvent() that returns to the main code?

Finally, why are you asking us this question? It's a C# question, not an AVR issue. Why don't you ask Microsoft? Is this a school project? Do you have tutors and lab assistants that help with PC Windows OS questions?

Is this a job assignment? Did someone in your company just give you a bootleg copy of C# install program on a CD-R (with no printed documentation) and tell you to install it on your PC. And then open the serial port and collect the data from some AVR prototype board.

Are you using C# to process the data that is coming into the PC serial port? If so, then first verify that the data is arriving and the serial port is configured correctly by using any terminal program. Have you done this already? If yes, then why didn't you tell us in your message? Have you studied the C# examples of configuring the serial port that are available from Microsoft and on the web?

I'm not trying to be a jerk, it just comes naturally.

Final question. How much are you actually willing to pay us for "please guide me how can i fix this?"? In Silicon Valley California, software consultation rates usually start at about $50/hr. Most consulting firms have PayPal accounts to facilitate international currency transfers.

Good luck.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

:O:O:O:O:O:O!!!!!!!!!!!!!!
i dont know how answer you!!!
1-this forum is a place to people ask question and it is free.!!
2-most of my question answer by mr.alexru complete and true without such your offer!!!
3-this is a student project
4-i fix my problem with USART_RX_BUFFER_LENGTH=64;
5-now i have another question!!!!!
in wsndemoapp.h:
typedef struct
{
uint8_t messageType;
uint8_t nodeType;
ExtAddr_t extAddr;
ShortAddr_t shortAddr;
uint32_t softVersion;
uint32_t channelMask;
PanId_t panID;
uint8_t workingChannel;
ShortAddr_t parentShortAddr;
uint8_t lqi;
int8_t rssi;
//additional field
uint8_t boardType;//1
uint8_t sensorsSize;//1
char pm[20];
struct {
int32_t battery;
int32_t temperature;
int32_t light;
} meshbean;
} PACK AppMessage_t;

then in wsnuarmanager.c:
static void readByteEvent(uint16_t readBytesLen)
{

READ_USART(&usartDescriptor, rxBuffer, readBytesLen);

memcpy(appMessage.data.pm,rxBuffer , readBytesLen);

}
but i cant see anything in appMessage.data.pm....
"PLEASE! HELP ME HOW I CAN FIX THIS!!!?";)