UART modems

i'm not sure if this is an appropriate forum for this question (or whether the network programming forum is more appropriate), but here's hoping!

I have a couple of XTEND MAXSTREAM (wireless, point to point) modems.

I have to modify an existing c++ application to use these modems for communication instead of using winsock.

I would like the communication between the modems to be reliable (like TCP as opposed to UDP). I believe there is an "RR" parameter that ensures this. but i'm not quite sure how to use it. if i enable this parameter on the modem (using the software that came with teh modems i guess!), do i have to do anything special in my code? or should the modem automatically take care of acknowledgements and stuff? do i have to check for them? or can i keep sending data out over a serial port?

I would also like to be notified of when the modem is ready to recieve data (ie, when the sending end has sent data and its queued up). I know you can use the select() function to do this if you are using sockets. but i'm not sure if it applies to these modems.. as i understood select(), it is more general on a unix platform than on a windows platform (i'm on windows) and is very restrictive about the types of paramaters it takes (i read this somewhere, so don't quote me on it!).

Also, i was wondering if anyone could tell me a little more about the "UART buffer". how big is it? how can i go about dealing with/preventing buffer overflow situtations?

i use the CreateFile(...), ReadFile(...) and Writefile(...) functions to communicate with the serial port. I also use the GetCommState, SetCommState functions.. but that is about the extent of my knowledge of communicating with a serial port!

really hope someone can help me out with this!
thanks!
drew.

ps. if you can recommend any good links for this type of stuff, it would be veyr useful too!
[1977 byte] By [drewdaman] at [2007-11-19 7:13:56]
# 1 Re: UART modems
hmm.. no replies... i guess i was a little too general... let me ask a more specific question:

can i use WaitCommEvent() to determine/wait for a particular event like being ready to send or not? if so, how can i do this? msdn says that:

EV_CTS The CTS (clear-to-send) signal changed state.

ok.. so can a scenario like this occur:

//pseudocode
while (data still to be sent){
Writefile (port, some data etc)
while (waitcommevent does not return EV_CTS){
waitforcommevent()
}
}

what if the data got sent right away as soon as you did a writefile? i'm not sure if this can occur.. but if it does the second while loop in the above pseudocode would just wait forever... and my understanding of this stuff is quite hazy as you can see! would this approach be correct to send large amounts of data? When exactly would EV_CTS change? similarly, when would EV_DSR change state? would EV_DSR change after the data has been received? or would it change before that? i'm just trying to understand this serial port communication stuff better before i really get started coding.. and i'm confused!

hope someone can guide me a little bit!
thanks
drewdaman at 2007-11-10 3:54:52 >
# 2 Re: UART modems
Hi, i guess im not here to guide you, but just want to share some things i'm doing the same thing as you are. a modem driver.

my modem is not wirless, its dirctly connected to one of the serial port, here is how i send the AT Command to the modem, Using write file, it would send the command to the modem as you write to the serial port, and it would echo back th command you send, so need to read the echo as soon after writing to the port.

then read from the from the port for respnse, i just made my program to wait for a few seconds (20 sec) and returs if timeout or all data has been receives. So basically thats how it is done, but now i need to make more spesific custumization befor i could connect to host, such as Using ASYNC or SYNC mode and so on, which i don't understand yet...

you can tak a look at these we, there are some articles on modem programming:

http://www.activexperts.com/activcomport/tutorials/modem/

Good Luck.
Max Payne at 2007-11-10 3:55:50 >
# 3 Re: UART modems
hi max,
thanks for replying.
my modem is also directly connected to the serial port, but it communicates with another modem wirelessly (ie a point to point wireless link).

i decided to switch to overlapped io since it seems to be more flexible and there is a lot more stuff available to read from google! i got some basic send/receive methods going using overplapped io. i think they should be good but i haven't tested them out fully yet.

i already have code that can send data between the modems.. but i need more "synchronization" (because the data does not SEEM to arrive in order- data not arriving in order is obviously not the problem, you have to use some sort of Wait function i guess- like in the tutorial below!). You mentioned AT commands.. i've been hearing a lot about these.. can you tell me what they are? i have no clue! i've never done this sort of thing before.. also i use SetCommState and GetCommState to set up the comm port...

if you haven't seen this already, take a look.. might be useful for you as well:
http://www.daniweb.com/techtalkforums/showthread.php?t=8020
drewdaman at 2007-11-10 3:56:56 >
# 4 Re: UART modems
hi max,

i already have code that can send data between the modems.. but i need more "synchronization" (because the data does not SEEM to arrive in order- data not arriving in order is obviously not the problem, you have to use some sort of Wait function i guess- like in the tutorial below!). You mentioned AT commands.. i've been hearing a lot about these.. can you tell me what they are? i have no clue! i've never done this sort of thing before.. also i use SetCommState and GetCommState to set up the comm port...

if you haven't seen this already, take a look.. might be useful for you as well:
http://www.daniweb.com/techtalkforums/showthread.php?t=8020

hi drewman,

thanks for the link, it sure deserves a bookmark. :)

in the link I gave, you can learn mor on AT Commands, they are simply command sets that you send to the modem, and the modem would reply accordingly to the command. for example, how do you dial the host number with your modem, I did using th AT command, every AT command must begin with "AT" followed by the command set, for example for dialing a host phone number, "ATDT99999999" is usd, where "D" is command for dialing, followed by "T" is tweaks tone mode, and lastly th host phone number.

you can also used AT commands for other things like setting the link speed, the modem internel registers, and so on. so check out your modem documentation, what commands it support. basically all modem support all the listed commands, but som have extra featurs and setting which uss extra commands.

Regards.
Max Payne at 2007-11-10 3:57:50 >