OqtaDrive

Nagging hardware related question? Post here!
User avatar
xelalex
Bent Pin Expansion Port
Posts: 94
Joined: Thu Aug 04, 2011 9:55 am

Re: OqtaDrive

Post by xelalex »

OqtaDrive 0.5.3 has been released.


spkr
Bent Pin Expansion Port
Posts: 98
Joined: Tue May 04, 2021 6:52 pm

Re: OqtaDrive

Post by spkr »

Hi there,

Ive cobbled together an oqtadrive adapter following this schematic:
schemagic.png
I am using OSX (arm).
I have installed the 0.5.3 ino file to the arduino using the Arduino IDE software.
I have downloaded and run the 0.5.3 oqtactl software (arm).
I am able to visit the local website and subccesfully load a MDV file.

However, when I try to use the oqtadrive with my QL by doing f.e. `dir mdv3_' I get not found.
Here is a paste of my logs:

https://pastebin.com/ZJr1ZAaM

I checked, double checked, and triple checker my soldering, but found nothing out of the ordinary...

I am at a loss where to continue to debug this.

Would you be so kind and perhaps provide me with some feedback on what I can try next?

Regards,
Wietze


User avatar
xelalex
Bent Pin Expansion Port
Posts: 94
Joined: Thu Aug 04, 2011 9:55 am

Re: OqtaDrive

Post by xelalex »

The log has very little info. Please set log level to DEBUG, then run the dir command on the QL, after that, get the log. I'm sure we can sort this out.

Edit: To set log level when starting the daemon, do this:

Code: Select all

LOG_LEVEL=debug ./oqtactl serve --device /dev/tty.usb...
BTW, even though I'm quite fond of that hand drawn schematic you used :D, I created this at the very beginning of the project. There is a more up-to-date version available now at the project home.


spkr
Bent Pin Expansion Port
Posts: 98
Joined: Tue May 04, 2021 6:52 pm

Re: OqtaDrive

Post by spkr »

Attached you find the log running with debug.

As soon as I ahve it all connected AND power on the QL, the logging hangs/stops. (As seen yb the log)

[Edit:] I read on your project page to keep cables under 5cm, I have wiring that is longer (20cm from Arduino to Connector), I guess I should shorten them.
Attachments
oqtalog.zip
(9.08 KiB) Downloaded 68 times


User avatar
xelalex
Bent Pin Expansion Port
Posts: 94
Joined: Thu Aug 04, 2011 9:55 am

Re: OqtaDrive

Post by xelalex »

spkr wrote: Thu Nov 30, 2023 7:14 pm Attached you find the log running with debug.
As soon as I have it all connected AND power on the QL, the logging hangs/stops. (As seen yb the log)
From the log, we can see that the Nano is correctly flashed and serial communication works. However, it looks like there's tremendous noise at least on the COMMS_CLK line. When the QL idles, this signal should be low. However, the Nano repeatedly sees high at startup, which is why it erroneously detects your QL as a Spectrum (idle level is high there). After the initial sync it then constantly receives level changes an the COMMS_CLK line (that's all the CK CR OF DR messages), hence my suspicion about the noise.

What happens when you reset the Nano in this situation?
[Edit:] I read on your project page to keep cables under 5cm, I have wiring that is longer (20cm from Arduino to Connector), I guess I should shorten them.
This could actually be a reason. If you have an oscilloscope, you could check on the COMMS_CLK line. A faulty Nano could also be a cause, so if you have a second one, you could swap it out and check whether that changes anything.

If I understood correctly, you attach OqtaDrive to the Microdrive edge connector of your QL. Are the two internal drives still present and both work, i.e. do they at least briefly spin up when doing 'dir mdv1_' and 'dir mdv2_' ?

EDIT: A broken COMMS_CLK line could also cause the observed effect. I remember seeing similar log messages when I forgot to plug in the adapter. COMMS_CLK is floating in that case and can easily cause this. So checking the cable for continuity would be another idea.


spkr
Bent Pin Expansion Port
Posts: 98
Joined: Tue May 04, 2021 6:52 pm

Re: OqtaDrive

Post by spkr »

xelalex wrote: Thu Nov 30, 2023 9:07 pm
spkr wrote: Thu Nov 30, 2023 7:14 pm Attached you find the log running with debug.
As soon as I have it all connected AND power on the QL, the logging hangs/stops. (As seen yb the log)
From the log, we can see that the Nano is correctly flashed and serial communication works. However, it looks like there's tremendous noise at least on the COMMS_CLK line. When the QL idles, this signal should be low. However, the Nano repeatedly sees high at startup, which is why it erroneously detects your QL as a Spectrum (idle level is high there). After the initial sync it then constantly receives level changes an the COMMS_CLK line (that's all the CK CR OF DR messages), hence my suspicion about the noise.

What happens when you reset the Nano in this situation?
[Edit:] I read on your project page to keep cables under 5cm, I have wiring that is longer (20cm from Arduino to Connector), I guess I should shorten them.
This could actually be a reason. If you have an oscilloscope, you could check on the COMMS_CLK line. A faulty Nano could also be a cause, so if you have a second one, you could swap it out and check whether that changes anything.

If I understood correctly, you attach OqtaDrive to the Microdrive edge connector of your QL. Are the two internal drives still present and both work, i.e. do they at least briefly spin up when doing 'dir mdv1_' and 'dir mdv2_' ?

EDIT: A broken COMMS_CLK line could also cause the observed effect. I remember seeing similar log messages when I forgot to plug in the adapter. COMMS_CLK is floating in that case and can easily cause this. So checking the cable for continuity would be another idea.
I shortened all cables, and remeasured them (no faults as far as I can tell).

Attached you find another log with the attempt of shortened cables.
What I do is:
- turn on the oqtactl wihtout the Arduino connected to the QL
- after its initialzied, I connecft it to the QL
- then I remove the usb from the Arduino
- reattach the usb to the Arduino
- I do dir mdv1_ (it lights up)
- i do dir mdv3_ (not found)
- I shut down daemon

Hopefully this is helpful. Please not that I turn on the oqtactl initialy wihtout having it connected to the QL.

Thanks for your timely response and taking time to look into this individual case, its appreciated!
Attachments
log2.zip
(1.73 KiB) Downloaded 52 times


User avatar
xelalex
Bent Pin Expansion Port
Posts: 94
Joined: Thu Aug 04, 2011 9:55 am

Re: OqtaDrive

Post by xelalex »

spkr wrote: Thu Nov 30, 2023 9:20 pm What I do is:
- turn on the oqtactl wihtout the Arduino connected to the QL
- after its initialzied, I connecft it to the QL
- then I remove the usb from the Arduino
- reattach the usb to the Arduino
- I do dir mdv1_ (it lights up)
- i do dir mdv3_ (not found)
- I shut down daemon
I would not advise hot-plugging the Arduino to the QL! Only connect it when the QL is powered down!

Please revise your sequence as follows:
  • QL powered off and Arduino not connected to USB
  • connect Arduino to QL
  • connect Arduino to USB
  • start the OqtaDrive daemon
  • power on the QL
Is drive 2 still fitted in your QL and working?


gozdniJezek123
ROM Dongle
Posts: 8
Joined: Thu Nov 16, 2023 6:06 am

Re: OqtaDrive

Post by gozdniJezek123 »

Hello first time poster here, first of all thank you for this wonderful project!
I'm having issues with my build (dir mdv1_ returns not found on my QL), I went the hard way, because i tried the image, written with the raspberry pi image writer, but it did not work even with multiple different SD cards.
I'm using a cheap Arduino clone:

Code: Select all

https://www.aliexpress.com/item/1005002966043359.html
(it wont let me post links) (It has 16Mhz clock)
Software versions are:
daemon: 0.5.3-8-g2aab9d5
adapter: protocol 5, firmware 28
latest release: 0.5.3

I also tried to use the developer builds version but still no luck. I had to set the baud rate to 500000, because the default one was too much for my cheap Arduino to work properly.
Can someone please help me interpret the following lines in the log:

Code: Select all

time="2023-11-29T14:29:14+01:00" level=debug msg=fragmentation best=925 ideal-best=924 ideal-worst=1020 strict=false visited=925 worst=1020 zero=13
time="2023-11-29T14:29:14+01:00" level=debug msg="no file changes"
time="2023-11-29T14:29:14+01:00" level=debug msg="CK   8  [ 00001000 ] - 632.589887ms"
time="2023-11-29T14:29:14+01:00" level=debug msg="CR   0  [ 00000000 ] - 4.058987ms"
time="2023-11-29T14:29:14+01:00" level=debug msg="OF   0  [ 00000000 ] - 3.376988ms"
time="2023-11-29T14:29:14+01:00" level=debug msg="DR   0  [ 00000000 ] - 4.183986ms"
time="2023-11-29T14:29:15+01:00" level=debug msg="ping from QL"

My current assumption is that everything is somewhat working just one step is a bit off, but I don't know what to debug at this stage.

My nano config.h looks like:

Code: Select all

#ifndef OQTADRIVE_CONFIG
#define OQTADRIVE_CONFIG

#define BAUD_RATE 500000

#define LED_RW_IDLE_ON    false
#define LED_SYNC_WAIT     true
#define RUMBLE_LEVEL      0
#define DRIVE_OFFSET_IF1  0
#define DRIVE_OFFSET_QL   -1
#define HW_GROUP_START    0
#define HW_GROUP_END      0
#define HW_GROUP_LOCK     true
#define FORCE_IF1         false
#define FORCE_QL          true

// set this to true if you added the write protect boost circuit
#define WR_PROTECT_BOOST false

#endif
and my oqtadrive.service (I also tried both settings for OLD_NANO):

Code: Select all

[Unit]
Description=OqtaDrive Daemon
After=local-fs.target sysinit.target

[Service]
Environment=LOG_LEVEL=debug PORT=/dev/ttyAMA0 BAUD_RATE=500000 OLD_NANO= RESET_PIN=18 FQBN=arduino:avr:nano
ExecStart=/home/pi/oqtactl serve -d /dev/ttyAMA0 -b 500000
WorkingDirectory=/home/pi
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi
KillMode=process

[Install]
WantedBy=multi-user.target

Also a note for the project code repository can you maybe also include additional information to the debugging section as it helped me a lot:

To check if your Arduino is programmed correctly, it can be connected to the computer via USB and you can check what is being sent to serial in Arduino IDE

To debug the serial on raspberry pi first you must find your serial device:

Code: Select all

dmesg | grep tty

Code: Select all

 pi@raspberrypi:~ $ dmesg | grep tty
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_headphones=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.en                                      able_hdmi=0 video=Composite-1:720x480@60i smsc95xx.macaddr=B8:27:EB:1D:E7:30 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  console=t                                      tyAMA0,115200 console=tty1 root=PARTUUID=6eb19e83-02 rootfstype=ext4 fsck.repair=yes rootwait
[    0.001637] printk: console [tty1] enabled
[    3.864306] 20201000.serial: ttyAMA0 at MMIO 0x20201000 (irq = 81, base_baud = 0) is a PL011 rev2
[    4.872236] printk: console [ttyAMA0] enabled
[    9.757494] systemd[1]: Created slice system-getty.slice.
[    9.791218] systemd[1]: Created slice system-serial\x2dgetty.slice.
install screen:

Code: Select all

sudo apt install screen
usage of screen command:

Code: Select all

sudo screen ttyAMA0 500000
you should get:
hloihloihloihloihloihloihloihloihloihloihloihloihloihloihloihloihloihloihloihloihloihloihloihloihl....

The issue I was having at the beginning was that my serial device is mapped as ttyAMA0 and not the default ttyS0.


I hope I provided enough information, otherwise please tell me what to include and I'll post an update. I know that setting up my own image has a lot of potential failure points, but It was the only way of getting it to somewhat work.
Thank you for your time and help!


gozdniJezek123
ROM Dongle
Posts: 8
Joined: Thu Nov 16, 2023 6:06 am

Re: OqtaDrive

Post by gozdniJezek123 »

Please also find attached a full log.
Attachments
OqtaDriveLog.zip
(2 KiB) Downloaded 57 times


User avatar
xelalex
Bent Pin Expansion Port
Posts: 94
Joined: Thu Aug 04, 2011 9:55 am

Re: OqtaDrive

Post by xelalex »

@gozdniJezek123 From the log, it looks like OqtaDrive is pretty much working, so I guess we're not that far off. But before we dive into debugging, could you tell us a bit more about your setup? Is it just the Nano connected to your PC (Linux, Mac, Win?), or did you build any of the PCBs, and if so which one?

How do you connect the Nano to the QL, to the external Microdrive port, or internal? Are the two internal h/w drives still present and working?
gozdniJezek123 wrote: Fri Dec 01, 2023 9:50 am I went the hard way, because i tried the image, written with the raspberry pi image writer, but it did not work even with multiple different SD cards.
What exactly did not work, writing the image or the automatic installation afterwards? The install process is very reliable, so I would be surprised if that didn't work. I don't know about the RaspberryPi image writer, standard image writer under Ubuntu Linux has been giving very good results so far.
I also tried to use the developer builds version but still no luck. I had to set the baud rate to 500000, because the default one was too much for my cheap Arduino to work properly.
I'd recommend using the latest official release until all works, then you could try development builds. Regarding the serial speed, I have used many different cheap Nano clones, and they were all capable of running the 1Mbps. They only situation where you need 500kbps is when you connect it to a BananaPi M2 Zero.


Post Reply