![]() |
Forum Index : Microcontroller and PC projects : MMB4L: what are the minimum serial comms capabilities it requires?
Page 1 of 2 ![]() ![]() |
|||||
Author | Message | ||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Hi folks, I have the basics of sending data to/from MMB4L and a USB connected 'mite, so that's 115200 baud, 8 bits, no parity and one stop bit. I'm now wondering what other serial comms capabilities I need to implement for a "minimal viable product". Obviously I need to support other standard baud-rates and adding support for the parity bit and/or two stop bits appears to be trivial so I may as well do it. I'm not planning on messing with the default receive buffer size or adding interrupt support until/unless someone starts using MMB4L "in anger" and will help me with the use-cases. But that still leaves the "haunted wing" of the other 'mites options: 7BIT, 9BIT, INV, OC, ODD, EVEN, DEP, DEN, which as far as I can tell from its source the Pi-Cromite didn't support (note the Pi-Cromite appears to bit-bang its serial comms, whereas MMB4L uses standard Linux kernel facilities). Should I consider any of this to matter for MVP ? Any opinions ? Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
I love it when you talk foreign... ;) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Yeah, hark at me pretending I know my arse from my elbow ![]() Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
What is the "default receive buffer size"? One of the great features of MMBasic serial comms is that if your buffer is large enough, the receiver can just forget about the sender and check LOF when it's convenient--no haste to pick up transmissions before they are lost. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5089 |
Linux makes use of the standard PC peripherals. These are targetted to comply with the standard communication requirements. INV: This is a hardware inversion of the signal lines. Does not make any sense if the hardware is in your pc or usb cable. 7bit: this used to be more common in the 80' s but last decennia I only used 8 bit. 9bit: even more obscure than 7 bit, although I have mis-used it once for a completely different purpose: Diseqc decoding. OC: drive the io pin of a microcontroller in open collector mode. With an external resistor you can deterine that the transmit level is 5V, even if the micro runs at 3.3V. Not important for MM4L. ODD, EVEN: yes, you need those if you want to do ModBus communication. DEP, DEN, in PC peripherals this signal (DTR) is generated in hardware. Microcontrollers need to assign this pin to an io pin. But you should include the option to enable and disable hardware handshaking. And maybe even XON XOFF. Volhout Edited 2021-12-13 05:14 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1132 |
Some, perhaps only older, industrial machinery likes (slow) 7 bit baud rates with parity. Extra stop bits are useful when needing to slightly reduce data rates. Visit Vegipete's *Mite Library for cool programs. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Maximum rate needs to be at least 230400 and preferably 460800+ There are times when non standard rates are required. I 'think' the Linux driver has a small buffer of 4k which can make life interesting. I have been trying to get a confirmation of the 4k size but no definitive answer yet. You need to be able to handle devices such as the picomite which runs at USB speed no matter what baud rate you set. Having a slow baud rate of 300 can be handy as vegipete points out. You need to be able to toggle the DTR if you want to talk to the picomite (unless that has been resolved) Jim Edited 2021-12-13 06:51 by TassyJim VK7JH MMedit |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Hmm, I'm not sure the phrase "minimal viable product" is in the vocabulary of you fine gentlemen ... or you have confused it with the phrase "everything including the kitchen sink" ![]() Done. Possibly there is a non-standard way of doing this, but the standard POSIX API for serial comms uses an enum for the speed and thus is restricted to a set of standard speeds. Anything more will be an exercise for the reader if/when the MMB4L source goes up on github. I can't see anything to control this in the POSIX API so I guess that means I will need an additional buffer implemented in MMB4L ![]() I'm not sure to what you refer, I've had no problems talking to the PicoMite using an explicit 115200 baud ... I am however talking to it via "virtual serial over USB", perhaps what you refer to is if I were using COM1/2 ? I suspect my biggest problem will be testing any of this, I don't have 40 years of accumulated electronics "junk" in the basement, probably this will have to be done using "change & pray". Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5089 |
I don't have 40 years of junk, but I maybe able to help you with testing. Volhout PicomiteVGA PETSCII ROBOTS |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Back in the early days of the picomite, I found that the pico would receive data ok but not send replies to MMEdit. I found that the USB code on the pico was looking for DTR and there was no way to turn that off. In Teraterm it was solved by turning hardware handshaking on (even though it was not really used by the pico). In MMEdit I had to add the command to assert DTR in the initialization code to get it to talk nice. As it works for you, either the DTR is asserted by default or the pico has been 'fixed'. Either way, if it works... It's not 'junk' that's filling up my shed, it's mementos of my younger years. Jim VK7JH MMedit |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2640 |
" I don't have 40 years of accumulated electronics "junk" in the basement, probably this will have to be done using "change & pray"." Perhaps those with a particular need can help you by writing a hardware emulator to do the testing with. This example is trivial for most of you but when I wanted to see if a DHT11 and DHT22 could share the same MM2 pin, but not having a DHT22 I wrote an emulator for an F4 to test it. (they can). "It's not 'junk' that's filling up my shed, it's mementos of my younger years." Yes had that, but reset to zero by Black Saturday. Edited 2021-12-13 08:13 by phil99 |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Thanks for the offer Volhout. I don't want to do additional pre-alphas, so I'm going to spend Christmas dotting the t's and crossing the i's with the intention of releasing an official alpha 3 - that includes the serial support - at the beginning of the New Year. Any testing you can do on that once it is in the wild would be greatly appreciated. Yes, I think that's the way to do it since what I have already implemented achieves all the functionality I personally required in this area. I'm sorry to hear that, it was unfathomably dreadful to read about it, I can't imagine what experiencing it was like. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
I was thinking that for "nostalgia" I might have mappings so that COM1-4 could be used in the specifications for serial ports, e.g. OPEN "COM1: 115200" AS #1 ' would be equivalent to OPEN "/dev/ttyS0: 115200" AS #1 OPEN "COM2: 115200" AS #1 ' would be equivalent to OPEN "/dev/ttyS1: 115200" AS #1 OPEN "COM3: 115200" AS #1 ' would be equivalent to OPEN "/dev/ttyS2: 115200" AS #1 OPEN "COM4: 115200" AS #1 ' would be equivalent to OPEN "/dev/ttyS3: 115200" AS #1 Is this a good idea or the ravings of a madman ? Another (more invasive) alternative would be to allow the user to configure COM1-4 as OPTIONs, e.g. OPTION COM2 "/dev/ttyS2" In which case should they be persistent or temporary options ? Best wishes, Tom Edited 2021-12-14 03:01 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
Both have their good points. The OPTION version, although more complex, allows very easy redirection of ports. That might come in handy on systems with a lot of ports available. You could perhaps use the OPTION version but make the defaults as shown in the first version unless changed. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
I'm indifferent except would you still be able to say this? OPEN "/dev/ttyUSB0: 115200" AS #1 (I.E., for serial devices which have other names.) PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Yes, only the names COM1-4 would have any special treatment. Any other name would be passed verbatim to the underlying C library / kernel and either work as expected or come back with the appropriate system error if invalid. Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Another serial comms query ... If I want to connect Linux/MMB4L to one of the COM ports on a CMM2 or PicoMite (other than the serial console) am I correct in believing this FT232 module is the device to use: ![]() I'm furthermore guessing I leave the VCC, RTS and CTS lines disconnected ? Does the VCC jumper (3.3V/5V) just control the VCC line, in which case it is irrelevant, or does it also control signalling levels ? In which case what should it be set to when talking to a 'mite ? Is there anything else I need to know in order to keep the magic smoke at bay ? Thanks in advance, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
That looks costly LOL I'm cheap and use such as CH340 USB-serial. Yes, set volts for the hardware, 3.3 commonly nowadays. (About the only 5V things I use are Arduinos, these days.) John |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4311 |
Not so much when it was in @lew247's care package. Thanks, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
LOL John |
||||
Page 1 of 2 ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |