uLisp Restricted Set of Serial Ports for M4 Boards


#1

Hi,

I’m looking at the possibility of using uLisp to implement part of a Battery Monitoring System for my off-grid house battery bank.

I’d be collecting information from the charge controller, 8S cell monitor and current monitor (with a Joule counter).

I’m considering using uLisp on a Metro M4 to collect information from the current monitor. The current monitor sends a continuous serial ASCII stream from a PIC16F884 (at 5V, which will require a level shifter), so I’ll need a serial port. Yes, M4 is probably overkill, but the 16-bit boards seem kind of skimpy, and older boards seem to be less available unless one wants to gamble with getting cheap knockoffs.

In researching, I stumbled upon a very recent forum post at Adafruit about serial on Metro M4 that stated that TX1 and RX1 on D0 and D1 are decoupled from USB and could be used without interference. I also learned that the Metro M4 has six configurable serial ports, though configuration seems somewhat complicated, with potential conflicts and other restrictions,

I’d like to use a Raspberry Pi for the UI, logging and to collect information from the charge controller (MODBUS, over RS-232, RS-485 or Ethernet) and the cell monitor (using a published serial protocol, over USB). Other than the UI and the logging, I could probably fit it all on the M4, and it might be more centralized to do it that way. However, the extra USB for the cell monitor and the port for one of the interfaces from the charge controller would entail complicating things and potential hardware conflicts, when the RPi already has four USB ports and an Ethernet port. I might do it all on the RPi, but that would entail breaching the case and dealing with configuring the serial from the current monitor, which I haven’t researched for the RPi.

When I looked at the uLisp code, I noticed that only Serial1 is defined for M4. Is this because other pins are not dedicated as serial, may interfere with other uses and would require customization in the uLisp code on an individual basis?

Can anyone confirm that I could use RX1 on the Metro M4 without interference from USB? Or should I look at using other pins on other ports?

Whereas I have years of programming experience (including Common Lisp), mostly as a hobby, I have little experience with this kind of hardware configuration. I briefly looked at the ATSAMD51 datasheet, but it’s a lot to digest for me. Can anyone point me to a more digestible explanation about the ins and outs of configuring serial ports on Arduino, potential conflicts, etc.?

Thanks.


#2

Okay, I actually found a more digestible explanation of the ins and outs in the Adafruit forum post that I mentioned above, and referring to the Arduino IDE source code for the M4 variant helped a lot. I also see in the code that USB is on different pins, so that should answer the question about using TX1 and RX1 on D0 and D1. I guess it pretty much answers the question about why uLisp only defines Serial1 and how to resolve it. Therefore, I seem to have answered my own questions. Hey, it was late.