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 : Device SerialTx problem
Author | Message | ||||
circuit Senior Member Joined: 10/01/2016 Location: United KingdomPosts: 245 |
This works infallibly; the code on the receiving PicoMite being: 'Picomite Simple Serial Client Option AUTORUN ON Dim string cmd SetPin GP1,GP0,com1 'Set up comms channel 1 Open "com1:19200, 256, ActionCommand, 3" As #1 Do WatchDog 500 'This recovers from errors not ignored but resets the chip Loop Sub ActionCommand 'Message receipt detected On ERROR IGNORE 'This avoids system reset if duff command arrives Pause 30 'ensure all characters in command have arrived Line Input #1,cmd 'Get the command Execute cmd 'Action the received command End Sub 'Return from the interrupt and the sending device; SetPin GP1,GP0,com1 ' SetPin GP1,uart1 Rx: SetPin GP0,uart0 Tx Open "com1:19200, 256" As #1 ' and then type directly print #1,"option heartbeat on" print #1,"option heartbeat off" The heartbeat LED switches perfectly, as do all other output pins when configured and set. But if I reset the sending device (killing the serial port) and then code; Device SerialTx GP0, 19200, "option heartbeat on" the same receiving device crashes. So, thinking I might need a CR + LF I tried; Device SerialTx GP0, 19200, "option heartbeat on" +chr$13 +chr$10 but again, the receiving device crashes. Dear friends, where might I be going wrong? Edited 2024-04-21 07:31 by circuit |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2135 |
Another thing to try (untested):- OPTION ESCAPE : Message$ = "option heartbeat on \n" : Device SerialTx GP0, 19200, Message$ |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
Start by increasing the watchdog timeout and the pause. Edited 2024-04-21 08:05 by TassyJim VK7JH MMedit MMBasic Help |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
Another thought bubble. Can the Device SerialTx command be used from the commandline or does it get cut short when you return to the command prompt? Easy to test by using INPUT instead of LINE INPUT Jim VK7JH MMedit MMBasic Help |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6098 |
Something I should have spotted sooner. You are missing the brackets in chr$(13) and chr$(10) If that fails, try putting the DEVICE command in a short program instead of commandline. VK7JH MMedit MMBasic Help |
||||
circuit Senior Member Joined: 10/01/2016 Location: United KingdomPosts: 245 |
Sorry, in fact when I was typing in the "real world" I did have the brackets - it was only when I was typing into this appeal for help late at night that I missed the brackets out. Sorry to mislead. Only just getting up in the morning here in the UK and I have a busy day in uniform with Royal Duties after which I will probably be too tired to get back to the computer. Back soonest to try out your suggestions; thank you. |
||||
circuit Senior Member Joined: 10/01/2016 Location: United KingdomPosts: 245 |
Jim, I had a few minutes spare after getting my uniform on (it takes quite a while to dress properly; full thing with sword etc. -sword slings are a pain in the neck!) so I switched on the computer and considered your first note about the timeout and pause. I simply upped the speed to 115200 on both units and hey presto, all is working! It is amazing the peace of mind that results; I can now concentrate on the day's duties without thinking around in the back of mind about what I was getting wrong in the programming! And yes, it works just fine from the command line. What a benefit it is to have friends in Australia working things out for you whilst you sleep. Many thanks. Edited 2024-04-21 18:06 by circuit |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
I also found that I was getting failures (dropped characters) at a lower baud rate, and all worked perfectly when I upped back to 115200. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
circuit Senior Member Joined: 10/01/2016 Location: United KingdomPosts: 245 |
It is always most reassuring to receive such a confirmation from a colleague, thank you for this feedback. Yes, 115200 appears to counter any time-out issues. |
||||
Print this page |