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 : COM2 and COM3 on MX470
Author | Message | ||||
alanb007 Newbie Joined: 08/05/2015 Location: AustraliaPosts: 4 |
Hi everyone This is my first post after building the 28 pin Micromite and then moving to the 64 pin MX470. I have problems with COM2 and COM3 on the MX470 as outlined below. Firstly, I have interfaced a ESP8266 to the 28 pin version and using this programme, I can run the AT commands and get the wifi working. Open "COM1:9600,1024" As #1 Do Print Input$(1,#1); Print #1,Inkey$; Loop I am running the latest firmware on the MX470 and have checked the pinouts as supplied in the download with the firmware. Whether I choose COM2 or COM3 whenever I issue any AT commands, I do not get the right characters coming back. I have read the manuals and trawled the forums but I cannot find a solution. I have changed the baud rate but it doesn't fix the problem. Also - the rate of 9600 works on the 28 pin version so 9600 should work on the MX470. The MX470 is working as I can run an LCD screen, DHT22 sensor and also a RTC module, so the hardware is fine. What on earth am I doing wrong? Any wise guidance would be greatly appreciated Thanks Alan |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Welcome Alan, I would start by doing some simple tests: 1> If you have a meter, check for continuity between the Pic pins and your 'external' com port connections. 2> If you have a USB-to-TTL module then try COM2 and COM3 directly into something like TeraTerm 3> If you can't perform test 2 above, then connect COM1 Rx to COM2 Tx (and Com1 Tx to Com2 Rx) and write a simple send/receive program setting both ports to the same baud settings The above could possibly be of some help for you. I don't see any reported issues in the 'bug list' so maybe some others can do some basic tests to see if it is a 'local' problem or a bug. I am not near a module currently for another few hours . . . WW For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
alanb007 Newbie Joined: 08/05/2015 Location: AustraliaPosts: 4 |
Thanks WW That was very helpful. I programmed the MX470 to send a test string to COM3 and I direct connected to it with USB to TTL with Tera Term. I got garbage until I changed from N81 to N71. Then I could read the characters. So - a step forward - now back to reading the manual and hopefully read the data on COM3 at N71 Appreciate the quick reply - thanks! Alan |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9075 |
I can confirm that the COM ports on the 470 do work, so there must be some external reason for why you are not getting back the expected data. Interesting code.... I would be more inclined to send data before you try to read from the port: Open "COM1:9600,1024" as #1 Do Do:Loop Until Inkey$<>"" Print #1,Inkey$; Do:Loop Until LOC(#1)<>0 Print Input$(LOC(#1),#1); Loop Untested, but this should wait for you to press a key, then it will forward that to the module on COM1, then wait for a reply from the module, then print that reply on the screen. Things may well be happening too fast on the 470 - remember that it's default speed is 100MHz, which is quite a bit quicker then the 48MHz maximum of the 170 chip, so by the time the module has replied to the 470, the 470 has missed it. The do:Loop until's will prevent that from happening. Also, if the module on COM1 responds with more then one byte, this will also be printed in one go - perhaps you are getting error messages back from the module or something - I am not familiar with the 8266. Smoke makes things work. When the smoke gets out, it stops! |
||||
alanb007 Newbie Joined: 08/05/2015 Location: AustraliaPosts: 4 |
thanks Grogster the code didn't work unfortunately. I need a break from this for a little while as I need to rethink this. I have a feeling I am missing something obvious - so some thinking time is in order. as ever - always happy to try other suggestions in the meantime! Thanks Alan |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Alan, Silly question but for Grogster's code you did short out Com1 Rx and Tx? I haven't checked his syntax though . . . For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
robert.rozee Guru Joined: 31/12/2012 Location: New ZealandPosts: 2294 |
what baud rate, parity, number of data bits (7 or 8), and number of stop bits (1, 1.5, or 2) does your ESP8266 module expect? if it expects 7-bit data and you send it 8-bit data (or vice versa), then things will go wrong. your module should have come with a manual (or a link to a PDF) containing this information. it is possible that the serial ports on the MX470 micromite may default to different numbers of bits than the MX170 micromite. remember that the MX470 code is still in beta. cheers, rob :-) |
||||
alanb007 Newbie Joined: 08/05/2015 Location: AustraliaPosts: 4 |
Hi Everyone Really appreciate the help on this. I have now got it working with the original code in my first post. Problem is - I do not understand why it now chooses to work. After reading Rob's email - I agreed it would be important to determine if the baud rate settings were different between the devices. So - I directly connected the ESP8266 to the USB-TTL module and 9600N81 worked. I programmed a simple loop on the MX470 to print a text string to COM3 then connected the USB-TTL directly to COM3 and it worked with N81. This was not the result I got last night - as per previous note, it would only work when set to N71. Why did N81 not work last night but it works today?? Last test was to enter the original code on the MX470 to send keystrokes to COM3 which was then connected to the ESP8266 and yes - it worked. I can send the AT commands and the module talks to me. I cannot fathom why it did not work last night but it does today. any wise insights?? Best Regards alan |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9075 |
Very strange.... As Rob mentions, the 470 is still in beta, and obscure bugs are still possible to find - several members here have found some in recent weeks! That being said, I have not been able to fault the serial ports - yet. You may have stumbled over some kind of obscure bug or something. I have no explanation as to why this is now working on the same code and settings, yet it was not working on those same settings the day before - too strange for me! Smoke makes things work. When the smoke gets out, it stops! |
||||
Print this page |