Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : MaxiMite serial out - extra LF byte?
Page 2 of 3 | |||||
Author | Message | ||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9310 |
Further testing has proved that you are correct, but I still cannot make the transmitter respond, no matter what, despite the fact that it SHOULD be responding now, it just won't. I am now correctly using the semi-colon thus: Print #1,"map" + chr$(13);, and this is showing perfectly on the terminals, and the 2nd MM I hooked up, but the transmitter is totally ignoring it. If I plug the transmitter into the serial port on the laptop, and type "map" followed by ENTER, it reads back the internal mapping. It should be working, but isn't. I don't get it...... Smoke makes things work. When the smoke gets out, it stops! |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9310 |
OK, as an experiment, I hooked up a PICAXE chip(as I already had one handy on a serial message generator board), and programmed the PICAXE with the following: #picaxe 14m2 #no_data symbol one=pinC.3 symbol two=pinC.4 symbol three=pinC.0 symbol four=pinB.3 symbol five=pinC.2 symbol six=pinC.1 symbol seven=pinB.4 symbol eight=pinB.5 symbol ACK=B.1 symbol IO1=pinB.2 symbol FLASH=b2 symbol F=b3 symbol X=b4 symbol T=w0 low ACK T=500 high B.0 DO if eight=1 then high B.0 setfreq m16 serout B.0,T2400,("MAP",CR) pulsout ACK,T pause T setfreq m4 endif LOOP There are 8 different buttons on this PICAXE board, each one generates a different message - I have only reprogrammed button 8 for this test. However, with this PICAXE circuit feeding a 232 corrector, then on to the pager transmitter, it responds perfectly. Note that in my case, I am running the code at 16MHz to make the T2400 output at 9600 baud - this is all working fine. So, the transmitter is responding, but only to the PICAXE - it won't respond to the MM version of this code. Next, I will try feeding the MM output via the external 232 corrector I am using for this PICAXE experiment, to see if for some reason, there is a problem with the CMM2's 232 corrector - anything is possible. The in-depth investigation continues...... Smoke makes things work. When the smoke gets out, it stops! |
||||
MicroBlocks Guru Joined: 12/05/2012 Location: ThailandPosts: 2209 |
You could try sending one character at a time. I have had problems with controlling a serial LCD before. The microcontroler on that LCD was a PICAXE. If i recall it right the PICAXE has only bitbanged serial IO. As such it introduces a slight delay between characters when sending. (I confirmed that with a logic analyzer) Probably the reason why your device works with a PICAXE and not with the uMite. I had to insert a pause of about 5 msec between each character to make the PICAXE (on the LCD) work. If the data is correct then it probably has to do with timing. Microblocks. Build with logic. |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9310 |
Thanks for the hint, TZA. I have just tried it with the external 232 corrector, and nope - no-go. Not a sausage. Yet, on the PICAXE based board, it works every time a coconut - I cycled it several times to make sure - transmitter responded every single attempt. I will now try sending seperate bytes with a pause as you suggest - willing to try ANYTHING at this point!!! If the port is sending at 9600 baud, it should not matter should it? The timing pauses I mean - 9600 baud on one device, SHOULD be 9600 baud on another should it not? Smoke makes things work. When the smoke gets out, it stops! |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9310 |
OK, added 5ms paused between each character - totally ignored. Perhaps the simplest solution to this nightmare, would be to use a PICAXE chip as a serial-port interface? I would not have thought this necessary, but there is something that the pager transmitter likes about the PICAXE, that it does not like about the MM. Just now I connected the 232 corrector back to the laptop, and tried all sorts of things on the MM, and the terminal sees everything, and it is exactly right, but the transmitter just refuses to see it - I didn't think that serial comms could be THAT specific about not liking a signal. What voltage should there be on the 232 side of things? I am getting -7.5v idle between TXO(output of 232 corrector - goes to PC) on the CMM2 unit, and -5.4v on the external 232 corrector - but neither one works on the transmitter UNLESS I use the PICAXE chip - then it does. Confusing..... EDIT: I connected the PICAXE chip to the 2nd CMM2 unit, and it's numeric byte display code, and it is showing the PICAXE bytes fine, and they are exactly the same as the ones generated from the MM. Anyone got a nice large 4x2???????? Smoke makes things work. When the smoke gets out, it stops! |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3817 |
Don't give up - you've made progress (such as adding that ; ). It sounds like it has to be voltage level, number of stop bits, waveform shape, grounding, baud rate speed (xtal derived?) or the like. John |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6103 |
AS an experiment, I would try connecting the Rx of the maximite to the rx of the picaxe. Both being inputs should be OK. Then send a command from the picaxe and see if you get a response appearing on the maximite. It should be the same as on the picaxe. This tests the receive side of things and proves that you have polarity correct as well as baud rates. Jim VK7JH MMedit MMBasic Help |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9310 |
@ JohnS - thanks for the encouragement. We will solve it one way or another, sooner or later - I don't like unsolved mysteries. @ Jim - I have connected the PICAXE to the MM, and that works fine(the MM responds fine via it's serial port buffer), and I was planning to setup a 8-pin PICAXE with SERIN and send something from the MM to it, so I will let you know about this in due course. Once I have the 8-pin PICAXE in place, I can then connect the PICAXE and MM together as you suggest Jim, and can see what happens when I trip them both at the same time, with the serial message generator(based on the PICAXE 14M2). In this image, the first three lines are the output from the 1st MM to the 2nd MM. The last three lines are the output from the PICAXE to the MM. Sorry the image is a little fuzzy - all lines are the same and read: 77, 65, 80, 13, In other words: "map<cr>" Stay tuned for developments!!!! Smoke makes things work. When the smoke gets out, it stops! |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9310 |
UPDATE: Feeling as though it is the pager transmitter giving me the hard time, I have put that to one side for the moment, and dug out a GSM terminal. This is a serial-controlled GSM cell-phone unit, but as it talks using RS232, I thought I could try it. The good news is that the GSM unit responds perfectly to any command I send it via the MM. I have the MM feeding the 232 level corrector on the CMM2 board, and then the output from this, feeding into the GSM terminal, with it's responses routed back to the laptop. This arrangement means I can send a command from the MM, and read any response from the connected device on the laptop. I can query the GSM module fine, and can adjust settings, and send messages to my cellphone - all from the MM command-line - no problems whatsoever. Yes - before anyone asks - I also tried this arrangement with the pager transmitter(cos I all I had to do was unplug the serial from one, and move it to the other), but it does not respond at all - same old, same old there. I think the problem has to therefore be, the fecking pager transmitter - for SOME reason(and I am buggered if I know what that is) it will not accept any commands from the MM based serial port - even with correct RS232 level correction in place - full stop. Smoke makes things work. When the smoke gets out, it stops! |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3196 |
I wonder if the internal clock of the Micromite is slightly off, which would make the baudrate slightly wrong. On the Micromite you can use whatever number you want for the baudrate. So you could try 9600, then 9601, then 9602, etc. Geoff Geoff Graham - http://geoffg.net |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9310 |
I don't think so, Geoff. I think it comes down to the stupid pager transmitter being overly pedantic with respect to the way you talk to it. I have been playing around for the last three hours or so, with the GSM cell-phone module, and it is working GREAT - no problems at all talking to this one, or the ElecFreaks SIM900 GSM module either - they are happily playing ball without issue. My test code for these is: Open "COM1:9600" As #1 Print #1,"AT+CMGS=" + chr$(34) + "00000000" + chr$(34); 'Cell-phone number to send txt too Pause 150 'Gotta let the module do it's thing... Print #1,"Test message." + chr$(26); 'Send message and CTRL+Z to send End I have replaced the actual test cell-phone number here, with zeros for privacy, but other then that change, the code is working beautifully - I have had many text messages in the last few hours.... Smoke makes things work. When the smoke gets out, it stops! |
||||
VK2MCT Senior Member Joined: 30/03/2012 Location: AustraliaPosts: 120 |
If inclined would you please post the code that you are currently using to send to the pager transmitter. Am i correct in saying that there is now no response, but that initially with incorrect semicolons, you were at least getting an error? Does case of 'map' 'MAP' matter ? John B |
||||
Goeytex Regular Member Joined: 12/05/2014 Location: United StatesPosts: 74 |
Grog, It seems you have the extra LF thing sorted out. Here are some thoughts. A Picaxe 14M2 using software "serout" actually formats the data with three stop bits instead of one. This means that there is an extra ~208 microseconds between data bytes. There is no significant difference in bit rate between the Picaxe and the Micromite. Both are very close to 9600. Picaxe 9594. Micromite 9640. I set up the the breadboard with a Picaxe 14M2 and with a Micromite and then sent "MAP"<CR> with each. Here is a screen shot showing the difference between the two as reported by Saleae Logic. You can clearly see the extra stop bits with the Picaxe. Note: I used a Maximite with MMBasic V4.5D. The Logic Analyzer is a clone from EBAY for ~$12.00. I cannot imagine troubleshooting serial data problems without one. You might try: OPEN "COM1:9600,S2" as #1 This will ad an extra stop bit. Blow is a screen shot with Micromite on top using 2 stop bits (S2) and Picaxe below with its built in 3 stop bits. |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9310 |
If you just look back on page two of this thread, you will find the last code that I tried. Since then, I have abandoned the pager transmitter in favour of playing with the GSM module. Yes, when I was NOT suppressing the CR/LF that is automatically added, the transmitter was responding, but always with syntax errors. Once I suppressed the CR/LF, and just added the CR only, the transmitter fails to respond at all. BUT - if I plug the transmitter directly into the laptop and terminal, I can issue commands fine, and it responds perfectly - transmitter is being VERY pedantic about data you send it, and looks like there is no allowance for the slightest error here. @ Goeytex - A very good idea - I will try this later today. Smoke makes things work. When the smoke gets out, it stops! |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9310 |
SUCCESS!!! If I use the S2 option, the pager transmitter is happy as Larry, and everything is working, and I was able to send a test page, just by using the MM command-line. Goeytex - I owe you a HUGE beer or whiskey or vodka or whatever you drink. That was an excellent idea, and one I had never thought of, but obviously was where the problems was. Thanks to everyone who also added their suggestions and thoughts. Now I can get back to finishing things, now that I know what I need to change in the code to make it work. Smoke makes things work. When the smoke gets out, it stops! |
||||
MicroBlocks Guru Joined: 12/05/2012 Location: ThailandPosts: 2209 |
I now wonder why the 5 msec pause between each character did not work. It basically adds time between characters stretching the stop bit. A stopbit is defined to have a minimum duration but it can be as long as you want. Goeytex measured about 208 usec which is about 25 times shorter then the 5 msec, so it should have worked. Microblocks. Build with logic. |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9310 |
I will try the 5ms thing again out of interest, but I did put that in, and the transmitter just ignored it. Perhaps 5ms was too long? I never tried any other values, so will have a play with this idea now, just for academic reasons.... EDIT: 5ms pauses result in syntax errors, but if I go down to 3ms, then it does work. For some reason, it did not occur to me to try varying the pause delay - I guess my head was so muddled with all this, that something obvious like that did not seem to occur to me. UPDATE: I have made the changes to the main code to reflect what we need, and everything is working, even the pager transmitter now - YAY! Also, while rummaging around for something else, I came across the manual for the transmitter, and gues what? The serial protocal is listed as 8N2........ I made the mistake of ASSUMING that it was 8N1, which IS more common. Smoke makes things work. When the smoke gets out, it stops! |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6103 |
It could be like the Bluetooth modules I am playing with. They will spit the dummy if the command characters don't arrive quickly enough. It made life difficult until I worked that one out. I agree though, failing with 5ms delay is very poor. Jim VK7JH MMedit MMBasic Help |
||||
Goeytex Regular Member Joined: 12/05/2014 Location: United StatesPosts: 74 |
My guess is that this pager device is measuring the frame time and throwing an error if the stop bit is > < than a predetermined amount. It may just be looking for a "space" > 2 stop bits ( 208us) and less than xxx microseconds, to increment a byte counter and start looking for the next start bit. If no byte in xxx us then throw an error flag and reset? Who knows what the engineers had in mind? Agree it is poorly done, but I imagine the designers have a good reason in their own minds. But the good news is that it is now working. Hey Grog, If you are really gonna play with it some more, you can just add a series of "pause 0" between each byte, until it fails. Each pause 0 should add about 50us - 60us. If MMBasic won't allow a pause 0 then something like "a = 0" should work. |
||||
MicroBlocks Guru Joined: 12/05/2012 Location: ThailandPosts: 2209 |
I have had so many serial devices fail on me when using the CMM that the only way to get it working was introducing a pause between each character. On the logic analyzer it looked good though, it is that most devices are just slow.. I have had problems between a CMM and PICAXE chips, LCDs, Modems, etc. Now i just use a small sub to send characters to the serial port and for each device i just tweak the length of the pause. Having everything going through a small subroutine is also handy when you want to redirect the output. I did not encounter problems when the pauses where longer than necessary. Good to know that some devices have some sort of 'timeout'. Not much has changed, even in the seventies and eighties i often had to include a for l=1 to 100:next (no pause command was available) to get things working. :) Microblocks. Build with logic. |
||||
Page 2 of 3 |
Print this page |