Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serial support for Pico1140? #6

Closed
guidol70 opened this issue Dec 28, 2022 · 44 comments
Closed

serial support for Pico1140? #6

guidol70 opened this issue Dec 28, 2022 · 44 comments

Comments

@guidol70
Copy link
Contributor

guidol70 commented Dec 28, 2022

Hi Ian,
do you think its possible to get serial-port-support for the terminal-output
(against the USB-CDC-serial)?

I did try to get it working myself, but failed.

In CMakeLists.txt I changed
from
pico_enable_stdio_usb(Pico_1140 1)
pico_enable_stdio_uart(Pico_1140 0)
to
pico_enable_stdio_usb(Pico_1140 0)
pico_enable_stdio_uart(Pico_1140 1)

In getline.cxx and kl11.cxx i replaced
tud_cdc_write_char ==> uart_putc
tud_cdc_flush ==> couldnt find the same for serial/uart - maybe stdio_flush
tud_cdc_available ==> uart_is_readable
tud_cdc_read_char ==> uart_getc

I also did add the configuration/init of the uart to getline.cxx
and commented out the wait for SB-conected in Pico_1140.cxx

[EDIT]
I did it get working in the 2nd try - was mainly my non-working serial-telnet-server on a ESP8266, now the serial-telnet-server is on a ESP32S2 ;)

But only small thing I which dont like in my part-of-code - I dont know to get the right SCOPE for 2 settings - which I have to include in getline.cxx, kl111.cxx and Pico_1140.cxx:

#include "hardware/uart.h"

#define UART_ID uart0
#define BAUD_RATE 115200

The follwing I only have in the Pico_1140.cxx:

// We are using pins 0 and 1, but see the GPIO function select table in the
// datasheet for information on which other pins can be used.
#define UART_TX_PIN 0
#define UART_RX_PIN 1    // Set up our UART with the required speed.

and this after int main():

    uart_init(UART_ID, BAUD_RATE);
    // Set the TX and RX pins by using the function select on the GPIO
    // Set datasheet for more information on function select
    gpio_set_function(UART_TX_PIN, GPIO_FUNC_UART);
    gpio_set_function(UART_RX_PIN, GPIO_FUNC_UART);

As attachment my changed files:
Pico1140_serial.zip

And I got no clue how to wait for the serial connection like you do with USB.
I got such a thing for RunCPM in the Arduino-IDE:

// ==========================================================
// Wait for a # keypress to show-up the Startup-Messages
// ==========================================================
 int bootup_press = 0;
 int bootup_byte  = 0;
 int bootup_led   = 0;
 
  _clrscr();
 //  _puts("Waiting 2 seconds before starting keypress-routine...\r\n");
 // delay(2000); // wait for ROM-Messages and then flush the serial interface
 Serial.flush();
   while (bootup_press == 0)
     {
       if (Serial.available() > 0)
        { bootup_byte = Serial.read();
            if (bootup_byte == 35) // ASCII-Code 35 = #
              { bootup_press = 1;}
        }
        
        _clrscr();
        _puts("Press the \e[1m#\e[0m key to \e[1mbootup\e[0m RunCPM :)\r\n");
        
        if (bootup_led == 0) {bootup_led = 1 ; digitalWrite(LEDG, HIGH);}
            else             {bootup_led = 0 ; digitalWrite(LEDG, LOW); }
          
        delay(250);
    
     }
   Serial.flush();
   digitalWrite(LEDG, LOW);
   
// ==========================================================

But dont knwo how to program it in the Pico-SDK:

Kind regards
Guido

@Isysxp
Copy link
Owner

Isysxp commented Dec 28, 2022

Dear Guido,

Thanks for this. I am afraid that the Pico-SDK serial IO scheme is not great as several changes need to be made to change from SerialUSB to Serial. I would note that I have found the SerialUSB system to be quite reliable. However, I assume you wish to connect the Pico to a 'proper' terminal. I think your code is fine.
Normally, you do not need to wait for the Serial line to be active. However, you cannot easily. tell if anything is connected at the other end. For this you will need some extra lines from the Pico to your Serial device ... these are DTR/DCD and possibly RTS/CTS (modem signals). Personally, I wouldn't bother and just make sure the terminal is online before you press reset!!!

Regards, Ian.

@guidol70
Copy link
Contributor Author

Thanks for this.
I would note that I have found the SerialUSB system to be quite reliable.
However, I assume you wish to connect the Pico to a 'proper' terminal.
I think your code is fine.

Dear Ian,

Normally I also like the easy way to connect to USB ;)
But sometimes its interesting to connect the system to another device and then the serial way is the prefered one ;)

Also I had talked to some people and they would connect - as you wrote - a proper terminal like a read DEC Terminal or a serial Bluetooth-Converter :) I also like this serial2Telnet-Thing.

I was surprised that my code did worked so well. Its great to hear that you will find my code "fine" too ;)

Kind Regards,
Guido.

@guidol70
Copy link
Contributor Author

Dear Ian,

I did it now the following way:
I created a set_aurt.h and included this one in all of th 3 files - "problem" solved for me :)

The huy who wants to connect the Pico_1140 serial to a real VT100 did need a 9600 Baud version.

In the first try the version did also use 115200 Baud because the
stdio_init_all();
in Pico_1140.cxx seem to stanard-init with 115200 Baud :(
(did read that some time anywhere)

So I did after the normal init a full_uart _init
stdio_uart_init_full(UART_ID, BAUD_RATE, UART_TX_PIN, UART_RX_PIN);
and now the serial port is correctly initialized at 9600 Baud ;)
which doesnt seem much slower than the 115200 Baud :)

Kind Regards & a happy new Year 2023,
Guido

@Isysxp
Copy link
Owner

Isysxp commented Jan 1, 2023

Dear Guido,

Thanks again. I am not surprised about the apparent serial speed. The serial I/O is throttled at 1 transaction per 10000 cpu cycles. You could reduce this (see line 161 in avr11.cxx (500) and kl11.cxx (20)) a bit but other problems may arise. I think the speed is about right and is about 9600 baud or so.

Regards, Ian.

@guidol70
Copy link
Contributor Author

guidol70 commented Jan 3, 2023

Dear Ian,

the serial speed at 9600 Baud seem quite OK for me.
With a ESP8266/ESP32-serial2Telnet-Adapter it doenst look so fine like on a VGA32-FabGL-Terminal when connected serial at 9600 Baud - but thats because of the Telnet-packet-size then the output doesnt look so fluid ;)

Kind Regards
Guido

Pico1140_VGA32_FabGL_Terminal

Pico1140_FabGL_Screen

@Isysxp
Copy link
Owner

Isysxp commented Feb 14, 2023

Please see the latest info in the images directory of the repo. The .UF2 file has been built with both serial and USB support.
By default the baud rate is 9600.
You can use either or both. NB this build will not wait for a USB connect and the data will stream from the serial port(s) immediately. See line 106 in Pico_1140.cxx to enable/disable a wait for a USB connect.
I will close this thread as the serial option is now working.

@Isysxp Isysxp closed this as completed Feb 14, 2023
@guidol70
Copy link
Contributor Author

Please see the latest info in the images directory of the repo. The .UF2 file has been built with both serial and USB support. By default the baud rate is 9600. You can use either or both.

Dear Ian,
many Thanks for this very elegant design for both type of ports! ;)
In my mind I have memorys that you mentioned the chance for a type of config-file?

Great to this would be a top-notch for reading a config-file before starting the real Pico_1140 emulation and to set the parameters of Pico_1140.cxx and hw_config.c from from the config-file in a format like this:

UART0TX:0
UART0RX:1
UART1TX:20
UART1RX:21
UART0SPEED:9600
UART1SPEED:9600
WAIT4USB:1

SPIBUS:1
SPIMISO:12
SPIMOSI:15
SPISCK:14
SPISS:9

Do you think thats possible? Thats would be very hepfull for a simple and universal "onthefly"
hw-/sw-configuration.

Kind regards
Guido

@spoofy-zz
Copy link

Hmmm, new version from git, build on linux VS-Code, I have only one USB port after power on.
Do I need to configure some special in source for extra USB port?

[1058248.390690] usb 3-1: new full-speed USB device number 14 using xhci_hcd
[1058248.568727] usb 3-1: New USB device found, idVendor=2e8a, idProduct=000a, bcdDevice= 1.00
[1058248.568737] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1058248.568740] usb 3-1: Product: Pico
[1058248.568742] usb 3-1: Manufacturer: Raspberry Pi
[1058248.568744] usb 3-1: SerialNumber: E6616407E34A7E22
[1058248.573907] cdc_acm 3-1:1.0: ttyACM0: USB ACM device

@Isysxp
Copy link
Owner

Isysxp commented Feb 15, 2023 via email

@spoofy-zz
Copy link

spoofy-zz commented Feb 15, 2023

Nope, it doesn't work.
With your uf2, I have 2 ports, but with my new build not. I have taken stdio_usb_descriptors.c from your earlier message to Guido on Google Disk.
Maybe i need to configure some in my linux, but ist is strange why works with your :-( .

Feb 15 16:35:30 dell-1 kernel: [1064113.489944] usb 3-1: new full-speed USB device number 27 using d
Feb 15 16:35:31 dell-1 kernel: [1064113.659188] usb 3-1: New USB device found, idVendor=2e8a, idPro0
Feb 15 16:35:31 dell-1 kernel: [1064113.659201] usb 3-1: New USB device strings: Mfr=1, Product=2, 3
Feb 15 16:35:31 dell-1 kernel: [1064113.659203] usb 3-1: Product: Pico
Feb 15 16:35:31 dell-1 kernel: [1064113.659205] usb 3-1: Manufacturer: Raspberry Pi
Feb 15 16:35:31 dell-1 kernel: [1064113.659206] usb 3-1: SerialNumber: E6616407E34A7E22
Feb 15 16:35:31 dell-1 kernel: [1064113.664302] cdc_acm 3-1:1.0: ttyACM0: USB ACM device
Feb 15 16:35:31 dell-1 mtp-probe: checking bus 3, device 27: "/sys/devices/pci0000:00/0000:00:14.0/"
Feb 15 16:35:31 dell-1 mtp-probe: bus: 3, device: 27 was not an MTP device
Feb 15 16:35:31 dell-1 mtp-probe: checking bus 3, device 27: "/sys/devices/pci0000:00/0000:00:14.0/"
Feb 15 16:35:31 dell-1 mtp-probe: bus: 3, device: 27 was not an MTP device

@guidol70
Copy link
Contributor Author

guidol70 commented Feb 15, 2023

Nope, it doesn't work. With your uf2, I have 2 ports, but with my new build not. I have taken stdio_usb_descriptors.c from your earlier message to Guido on Google Disk. Maybe i need to configure some in my linux, but ist is strange why works with your :-( .

Hi Spoofy-zz,

I changed
/pico-sdk/src/rp2_common/pico_stdio_usb/include/tusb_config.h
from
#define CFG_TUD_CDC (1)
to
#define CFG_TUD_CDC (2)

and copied
/pico-sdk/src/rp2_common/pico_stdio_usb/stdio_usb_descriptors.c

and it worked after the compile with 2 USB-ports:

[1797064.623343] usb 8-1: new full-speed USB device number 2 using ohci-platform
[1797064.858442] usb 8-1: New USB device found, idVendor=cafe, idProduct=4002, bcdDevice= 1.00
[1797064.858499] usb 8-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1797064.858519] usb 8-1: Product: TinyUSB Device
[1797064.858536] usb 8-1: Manufacturer: TinyUSB
[1797064.858552] usb 8-1: SerialNumber: 123456
[1797064.911958] cdc_acm 8-1:1.0: ttyACM0: USB ACM device
[1797064.913819] cdc_acm 8-1:1.2: ttyACM1: USB ACM device
[1797064.914017] usbcore: registered new interface driver cdc_acm
[1797064.914030] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

Please check if the first part of your pico-sdk path is /pico-sdk/ or /PICO-SDK/ for changing the first file.

stdio_usb_descriptors.zip
tusb_config.zip

@spoofy-zz
Copy link

YES, it was wrong PICO_SDK path in VSCode.
Shame on me :-P
Thanks all.

@spoofy-zz
Copy link

rsx 4.0 with FORTRAN IV and Cobol compilers, Basic is planned but need to solve some problems first.
Image has support for RL and RK devices, so you can mount one additional DK disk when image is running.
One TS tape device is also genned, so you can install software from tapes if image is running in simh, and perhaps
for the future tape device when is available in Pico emulation :-) .
rsxm32-for-cbl.rl02.zip

Two terminals are defined, so you can log in on the second terminal too.
Maybe some cleaning is also needed, but that some later.

@Isysxp
Copy link
Owner

Isysxp commented Feb 17, 2023 via email

@spoofy-zz
Copy link

spoofy-zz commented Feb 18, 2023 via email

@spoofy-zz
Copy link

Hello.
So, it is there. An rsx-4.6 image with pdp C v1.1. It exist also version 1.2 but tape is not readable.
Maybe somewhere is a better copy.
Bruno Novak
rsx11m46.rl02.zip

@Isysxp
Copy link
Owner

Isysxp commented Feb 19, 2023 via email

@Isysxp
Copy link
Owner

Isysxp commented Feb 20, 2023 via email

@spoofy-zz
Copy link

DCL:

CCC HELLO
LINK/CHECKPOINT HELLO,[1,1]CEISRSX/LIBRARY
RUN HELLO
Hello World!

@spoofy-zz
Copy link

Basic2 is a tough nut to crack, but I think I'll make it.

@spoofy-zz
Copy link

Here is an image with Basic Plus 2, running good on simh, but crashed on Pico_1140.
Maybe you have an idea what is wrong?

rsx11m46-bp2.rl02.zip

@Isysxp
Copy link
Owner

Isysxp commented Feb 23, 2023 via email

@spoofy-zz
Copy link

Here is BP2 install with EIS, but same result. It must be other problems.
Maybe is a problem with intensive disk I-O because BP2 is not installed with resident library, which I can not
make while it ask for too big partitions for RMSRES and BP2RES.
I am trying for 2 days, but unsuccessfully, 124 KW is the minimum for this. Perhaps an experienced RSX system programmer can do this.
rsx11m46-bp2.rl02.zip

@Isysxp
Copy link
Owner

Isysxp commented Feb 23, 2023 via email

@Isysxp
Copy link
Owner

Isysxp commented Feb 28, 2023 via email

@Isysxp
Copy link
Owner

Isysxp commented Mar 1, 2023 via email

@spoofy-zz
Copy link

Hello Ian!

Thank you very much. I will continue to work on images. Basic now works.

I wonder what the next error will be!
:-) No problem, if you really want:
Kermit crashes when you are in local mode connected to remote Linux running Kermit in server mode and issuing remote commands. It is not so essential, but that is also one issue. I can transfer files to image with SIMH or with second DK disc.
Best wishes, Bruno.

>KERMIT
Kermit-11 T3.60  Last edit: 21-Mar-89  

Check SHOW RELEASE_NOTES for possible incompatabilities
with previous releases of Kermit-11 and other Kermits.
Linked for RSX11M/M+ and P/OS 
Kermit-11>set line tt1:
Link device: TT1:   Speed not settable
Kermit-11>remote dir *.*
Packets received :  0         Naks:   0         Timeouts:  0

00:06:59  Task "...KER" terminated
          Memory protect violation
          R0=177666
          R1=015377
          R2=155161
          R3=000002
          R4=164501
          R5=011206
          SP=071352
          PC=155162
          PS=170010

>

@guidol70
Copy link
Contributor Author

guidol70 commented Mar 2, 2023

Dear Bruno, Thanks again for this. I have now fixed the app and Basic Plus 2 runs fine.

Dear Ian/Bruno
How to start BASIC Plus?
I did recompile today with these new kb11.*
BUT so get

>REM ...BP2
>INS LB:[1,54]BP2IC2/TASK=...BP2/INC=1000
>BP2
00:04:10  Task "...BP2" terminated
          Reserved inst execution
          R0=003600
          R1=000102
          R2=027020
          R3=032232
          R4=020522
          R5=000000
          SP=001316
          PC=042222
          PS=170000

Kind regards
Guido

@spoofy-zz
Copy link

spoofy-zz commented Mar 2, 2023

Hmmm. How much RAM you have in your uf2? I have built from Ian's git, and it has 112 KW.
Maybe is that issue? Or you're trying with my unsuccessful build with fpu? Please use the last one which I have to upload their
rsx11m40-for-cbl.rl02.zip

Booting file:rsx11m46-bp2.rl02 on RL0:
Ready

DEVICE MS000: NOT IN CONFIGURATION

  RSX-11M V4.6 BL56   112.K MAPPED
>RED DL:=SY:
>RED DL:=LB:
>MOU DL:RSXM56
>@DL:[1,2]STARTUP
>* PLEASE ENTER TIME AND DATE (HR:MN DD-MMM-YY) [S]: 
>TIM 
00:02:14 29-APR-74
>* ENTER LINE WIDTH OF THIS TERMINAL [D D:132.]: 
>SET /BUF=TI:132.
>ACS SY:/BLKS=512.
>;
>;**********************************************************************
>;* WELCOME TO RSX11 V4.6 BL56 SYSTEM RUNNING ON PICO1140 MICRO SYSTEM *
>;*                THIS IS AN EXPERIMENTAL BUILD                       *
>;*                 WILL BE UPDATED CONSTANTLY!                        *
>;*               INSTALLED IS DEC BASIC PLUS V-2.5                    *
>;*     SOME HINTS FOR USING AND SOME SAMPLES IS IN LB:[6,1]           *
>;**********************************************************************
>;
>CLI /INIT=DCL/TASK=...DCL
>SET /CRT=TI:
>SET /TERM=TT0:VT100
>SET /TERM=TT1:VT100
>INS $PIP
>INS $EDT
>INS $TKB
>; Command file to install the BASIC-PLUS-2 compiler
>;
>; Remove old BP2 task
>; Install compiler task as BP2
>INS LB:[1,54]BP2IC2/TASK=...BP2/INC=1000
The BASIC-PLUS-2 installation is complete.
>@ <EOF>
>BP2

PDP-11 BASIC-PLUS-2 V2.5-00

BASIC2

10 FOR N=1 TO 5
20 PRINT N
30 NEXT N
RUN
NONAME  12:02 AM        29-Apr-74


 1 
 2 
 3 
 4 
 5 

BASIC2

^Z
%Unsaved change has been made - EXIT or CTRL/Z to exit.

BASIC2

.

@guidol70
Copy link
Contributor Author

guidol70 commented Mar 2, 2023

Hmmm. How much RAM you have in your uf2? I have built from Ian's git, and it has 112 KW. Maybe is that issue? Or you're trying with my unsuccessful build with fpu? Please use the last one which I have to upload their rsx11m40-for-cbl.rl02.zip

Strange - I added the latest changes for kl.* and kb.* from the commits to my source, but only have 96.K MAPPED
When and whre are the changes for 112KW? - when not in the KL11.* change/commit?

And in your file rsx11m40-for-cbl.rl02.zip is only a version rsxm32-for-cbl.rl02
Is thats right?

With this rl02 I do get:

>INS LB:[1,54]BP2IC2/TASK=...BP2/INC=1000
INS -- File not found

@spoofy-zz
Copy link

spoofy-zz commented Mar 2, 2023

Sorry, wrong image. There is one more time.
rsx11m46-bp2.rl02.zip
Ian will answer for the exact commit with the change to 112 KW, I didn't ask, so I don't know.

@guidol70
Copy link
Contributor Author

guidol70 commented Mar 2, 2023

Sorry, wrong image. There is one more time. rsx11m46-bp2.rl02.zip Ian will answer for the exact commit with the change to 112 KW, I didn't ask, so I don't know.

Found the 112KW change in unibus.* when the RL-handler was updated. ;)

With your new image it does work :)

Booting file:rsx11m46-bp2.rl02 on RL0:
Ready

DEVICE MS000: NOT IN CONFIGURATION

  RSX-11M V4.6 BL56   112.K MAPPED
>RED DL:=SY:
>RED DL:=LB:
>MOU DL:RSXM56
>@DL:[1,2]STARTUP
>* PLEASE ENTER TIME AND DATE (HR:MN DD-MMM-YY) [S]:
>TIM
00:00:15 29-APR-74
>* ENTER LINE WIDTH OF THIS TERMINAL [D D:132.]:
>SET /BUF=TI:132.
>ACS SY:/BLKS=512.
>;
>;**********************************************************************
>;* WELCOME TO RSX11 V4.6 BL56 SYSTEM RUNNING ON PICO1140 MICRO SYSTEM *
>;*                THIS IS AN EXPERIMENTAL BUILD                       *
>;*                 WILL BE UPDATED CONSTANTLY!                        *
>;*               INSTALLED IS DEC BASIC PLUS V-2.5                    *
>;*     SOME HINTS FOR USING AND SOME SAMPLES IS IN LB:[6,1]           *
>;**********************************************************************
>;
>CLI /INIT=DCL/TASK=...DCL
>SET /CRT=TI:
>SET /TERM=TT0:VT100
>SET /TERM=TT1:VT100
>INS $PIP
>INS $EDT
>INS $TKB
>; Command file to install the BASIC-PLUS-2 compiler
>;
>; Remove old BP2 task
>; Install compiler task as BP2
>INS LB:[1,54]BP2IC2/TASK=...BP2/INC=1000
The BASIC-PLUS-2 installation is complete.
>@ <EOF>
>BP2

PDP-11 BASIC-PLUS-2 V2.5-00

BASIC2

@Isysxp
Copy link
Owner

Isysxp commented Mar 2, 2023 via email

@spoofy-zz
Copy link

Unfortunately, I can't try it because I don't have a serial interface on the Pico. USB only. Can you please send me a change in the code, so I can try to build a new image myself?

@Isysxp
Copy link
Owner

Isysxp commented Mar 2, 2023 via email

@spoofy-zz
Copy link

No, it still crashes, but it's interesting that sending from Pico to Linux works without problems, but the reverse direction generates "memory protect violation". I will try to somehow install kermit on the RT image and see if the problem is the same there.
But it may take some time. I need to remember how RT works with disks and see how to transfer the kermit binary from DECUS tape to an RT disk.

@Isysxp
Copy link
Owner

Isysxp commented Mar 3, 2023 via email

@spoofy-zz
Copy link

Same case in SIMH RT-11 FB monitor.
I don't know, I will be trying later. It is time for a cup of Coffee.

@Isysxp
Copy link
Owner

Isysxp commented Mar 3, 2023 via email

@spoofy-zz
Copy link

I don't know. However, i can send file from Pico to my Linux with c-kermit in server mode. It crashes when I run remote commands from Pico.
And what is more weird, I use SecureCRT which have built-in kermit support and can send files to Pico kermit in server mode.
Combining these two methods, a can send files to both direction.
I don't know how separate point of failure.
rsx11m46-ccc.rl02.zip

Here is my rsx11 image, on which is kermit installed and from which I tested if you wish to test.
To run kermit it is task installed as KER.

@Isysxp
Copy link
Owner

Isysxp commented Mar 4, 2023 via email

@Isysxp
Copy link
Owner

Isysxp commented Mar 4, 2023 via email

@spoofy-zz
Copy link

Hallo Ian,
Perfect, all works now.
I read that article a few days ago, and I'm surprised that I didn't come across that part where it was mentioned. I should have read more carefully. Thank you again, you made my day.

@Isysxp
Copy link
Owner

Isysxp commented Mar 5, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants