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 : Grateful for help with MM+ Com 4 Issue
Author | Message | ||||
sawasdee01 Newbie Joined: 23/12/2016 Location: United KingdomPosts: 33 |
Hi, I would be very grateful for any help / suggestions with the following:- I have a pcb upon which an ESP32 talks to a MM+ PIC32 via the MM+ COM 4 serial port. I have used the OPTION CONSOLE OFF command and set both ends of the link to 9600 baud, 8, 1. With a very simple program that bats out "Hello World" once a second from the ESP32 serial port (esp32 serial port 2) and an equally simple serial port test prog running on the MM+, everything works perfectly but, only if I do a CPU RESTART followed by a RUN on the MM+. If I start my simple serial port test prog on the MM+ in any other way (eg using a RUN directly after a download from MMEdit, or using RUN after a power up of the board) no characters are received by the MM+. Having got everything working via the CPU RESTART route, even if I END my prog (after doing a CLOSE on the serial port) and then launch the prog again, using RUN - no chars are received, until I do another CPU RESTART. IE nothing works until I do a CPU RESTART first. This behavior is 100% consistent across many attempts. My initial thoughts related to an electrical incompatibility existing between the ESP32 and PIC32 MM+ during the short period whilst both the ESP32 and the PIC32 power up. However, both devices seem to come out of reset with the relevant port pins set to 'input' and as the code on the ESP32 runs immediately after power up, it would be reasonable to assume that the TX and RX pins go straight to their respective (output/input) states. This may point to something happening within either OPTION CONSOLE OFF or something which makes CPU RESTART materially different to a conventional processor reset. I am currently using MM+ 5.04 on the 64 pin PIC32. I have checked the MM+ Change Log and cannot see anything that is immediately related to this item. Unfortunately, moving to another MM+ COM port involves quite a lot of pcb hacking, as all other COM ports are being used. However, I will have a go at this if necessary. Best wishes to all. Sawasdee. |
||||
KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1345 |
It's unfortunate that you can't easily try another port, that would at least remove any strange conflict with the USB Console from the equation. A reset command clears variable memory as does a power up, however a reset command doesn't power cycle the processor and ports (AFAIK). Mike. It's all too hard. Mike. |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9052 |
Rather then use COM4, you could use the SerialRx C-function, and set it up to listen to any I/O pin you like. That way, you would bypass this issue, and you can use any spare I/O pin as your serial-input. I have attached the Cfunction PDF to save you having to look for it, but it is part of the MMBASIC download ZIP from Geoff's website. SerialRx.pdf Smoke makes things work. When the smoke gets out, it stops! |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3649 |
Might it be to do with whether the port is already open in some cases? If so, it may be at the wrong baud rate or some such and needs a CLOSE etc. If so, you can work around it with various ON ERROR SKIP etc statements. John |
||||
sawasdee01 Newbie Joined: 23/12/2016 Location: United KingdomPosts: 33 |
First of all; a huge 'thank you' to KeepIs, Grogster and JohnS for their input. This morning, I bit the bullet and hacked the PCB, such that the ESP32 is now connected to the MM+ COM 1 (retaining the same TX/RX wiring arrangements). I also removed the OPTION CONSOLE OFF, such that OPTION LIST now shows no entries. I am pleased to report that everything now works perfectly - ie the MM+ is receiving data from the ESP32 on the MM+ COM 1 port without the need for CPU RESTARTs. So, to recap - IMHO it would appear that there is some aspect of using COM 4 on the MM+ with the OPTION CONSOLE OFF command, which makes the COM 4 port work differently to the other COM ports on the MM+. Please see first email in this topic for further details. Best wishes to all. Sawasdee |
||||
Print this page |