USIfAC II, technical problems & support [MERGED with Plus-related posts from original thread]

Started by ikonsgr, 17:23, 29 December 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

eto


GUNHED

http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

Brocky

Quote from: ikonsgr on 09:14, 06 December 23Well, i've tested the new connection method with manually ip/port on my windows 10 pc and it seems it works ok.
As for the closing error, i don't know why it does that, maybe it's a "glitch" because of the "forced" ip
thanks for having a look. i tried it a couple of times and garbage every time. then with no hardware changes, go back to the older version and it works, strange
any chance of releasing the source for the utility so i can play around with it?

@GL thanks for your efforts looking into that issue...

ikonsgr

Quote from: GL on 13:34, 06 December 23Hi everyone

I found the reason why Ulifac hangs with 464. It is not related to BUSY signal. The reason is very simple - Amsdos and Parados roms cannot be initialized without real FDC or FDC emulation, they hangs in the initialization code (seems like executing HALT in the loop somewhere).

In the Ulifac startup code there is CLC5 setup code for FDC emulation but it is turned off by default, if I change it to CLC5CON = 0x82 then all works great, (still testing it).

Also int the process of research found issue with ROMDIS signal, the RB3 direction is not set to out, so it is low all the time :picard:  Ulifac shouldn't work at all but hardly fighting with data bus it somehow loads ok ;D

Did some fixes in the Ulifac hex file and now testing it

 The CLC that controls the FDC emulation is by default disabled, because default initial boot function is "direct file mode" (which is obvious, for the FDC to work you would need to mount an image first). I never thought that AMSDOS emulation needed FDC too, but if that's the case why hang (btw, when this hang occurs? And does it happen with both ULIfAC and USIfAC?) occurs rarely only with specific 464?  ::)
About ROMDIS signal, this is controlled by the 2nd PIC on ULIfAC (that's why it seems as input on ULIfAC PIC) and on USIfAC it's the CLC3OUT this is defnined in Sub InitPPS section, so obviously it doesn't need to be set manually to output, in the code, if that was the case and PORTB.3 remained input, obviuolsy rmom emualtion wouldn't work. Nertheless i've added the direction set too.

ikonsgr

Quote from: Brocky on 05:03, 07 December 23
Quote from: ikonsgr on 09:14, 06 December 23Well, i've tested the new connection method with manually ip/port on my windows 10 pc and it seems it works ok.
As for the closing error, i don't know why it does that, maybe it's a "glitch" because of the "forced" ip
thanks for having a look. i tried it a couple of times and garbage every time. then with no hardware changes, go back to the older version and it works, strange
any chance of releasing the source for the utility so i can play around with it?
The window utility is written in Delphi (e.g. visual pascal), and it's rather extensive and complicated, but if you want i can upload it  to get a look at it.
Btw, i think it's important the order of setting the ip and connecting to CPC. You should FIRST manually set ip on windows program, AND THEN turn on amstrad and set wifi module using |WIFI, otherwise it will not work.

GL

Quote from: ikonsgr on 08:26, 07 December 23The CLC that controls the FDC emulation is by default disabled, because default initial boot function is "direct file mode" (which is obvious, for the FDC to work you would need to mount an image first). I never thought that AMSDOS emulation needed FDC too, but if that's the case why hang (btw, when this hang occurs? And does it happen with both ULIfAC and USIfAC?) occurs rarely only with specific 464?  ::)
About ROMDIS signal, this is controlled by the 2nd PIC on ULIfAC (that's why it seems as input on ULIfAC PIC) and on USIfAC it's the CLC3OUT this is defnined in Sub InitPPS section, so obviously it doesn't need to be set manually to output, in the code, if that was the case and PORTB.3 remained input, obviuolsy rmom emualtion wouldn't work. Nertheless i've added the direction set too.

Actually the debugging was done using Usifac v6 gcb code, I transformed my Ulifac board to Usifac by soldering some jump wires and taking out ram/rom expansion pic. And I can confirm that the same applies to Usifac (hangind and romdis disabled). To understand why it hangs then deeper investigation of amsdos code is required (maybe some hardware differences between 464 ?)

PS. If the romdis is generated by both pics in Ulifac then maybe the correct way is to pull it up through diodes ?

ikonsgr

Quote from: GL on 10:04, 07 December 23
Quote from: ikonsgr on 08:26, 07 December 23The CLC that controls the FDC emulation is by default disabled, because default initial boot function is "direct file mode" (which is obvious, for the FDC to work you would need to mount an image first). I never thought that AMSDOS emulation needed FDC too, but if that's the case why hang (btw, when this hang occurs? And does it happen with both ULIfAC and USIfAC?) occurs rarely only with specific 464?  ::)
About ROMDIS signal, this is controlled by the 2nd PIC on ULIfAC (that's why it seems as input on ULIfAC PIC) and on USIfAC it's the CLC3OUT this is defnined in Sub InitPPS section, so obviously it doesn't need to be set manually to output, in the code, if that was the case and PORTB.3 remained input, obviuolsy rmom emualtion wouldn't work. Nertheless i've added the direction set too.

Actually the debugging was done using Usifac v6 gcb code, I transformed my Ulifac board to Usifac by soldering some jump wires and taking out ram/rom expansion pic. And I can confirm that the same applies to Usifac (hangind and romdis disabled). To understand why it hangs then deeper investigation of amsdos code is required (maybe some hardware differences between 464 ?)

  If i get it right, you say that some 464 hang because FDC emulation is disable,while AMSDOS emulation is active? And this happens only on initial boot? If that's the case, i think it's rather easy to settle it,on USIfAC boot code, i only need to activate FDC upon boot, and then at the end of boot code, deactivate it again. I can make the changes and give you HEX file to test it, but since you have already a "test ring", i can give you the USIfAC latest assembly code and make the changes yourself (then you should pass it back to me to covert it into a bunch of byte numbers and place it in GCB code under "Table RSX_CODE as byte")

Quote from: GL on 10:04, 07 December 23PS. If the romdis is generated by both pics in Ulifac then maybe the correct way is to pull it up through diodes ?

 Initially i thought so, but after initial tries it seems that this doesn't affect the correct function of both PICs, so i didn't use extra diodes for that

Brocky

Quote from: ikonsgr on 08:50, 07 December 23
Quote from: Brocky on 05:03, 07 December 23
Quote from: ikonsgr on 09:14, 06 December 23Well, i've tested the new connection method with manually ip/port on my windows 10 pc and it seems it works ok.
As for the closing error, i don't know why it does that, maybe it's a "glitch" because of the "forced" ip
thanks for having a look. i tried it a couple of times and garbage every time. then with no hardware changes, go back to the older version and it works, strange
any chance of releasing the source for the utility so i can play around with it?
The window utility is written in Delphi (e.g. visual pascal), and it's rather extensive and complicated, but if you want i can upload it  to get a look at it.
Btw, i think it's important the order of setting the ip and connecting to CPC. You should FIRST manually set ip on windows program, AND THEN turn on amstrad and set wifi module using |WIFI, otherwise it will not work.
yup i was setting the server utility up before moving to the cpc and giving the |wifi command, but will double check that tomorrow

hmm im a n00b when it comes to delphi, but id like to take a look please

GL

Ok, just for curiosity found why exactly the amsdos stucks at rom initialization

c95e ed78      in      a,(c) ; read FDC main status register
c960 87        add     a,a ; transfer bit 7 ("data ready") to carry
c961 30fb      jr      nc,$c95e    

I tried on my 464 machine FDC main status register (port FB7E) reads value 120 (01111000) so the code can wait forever for my non-existent fdc to be ready :picard:

@ikonsgr and others with 'not hanging' 464's can you test what returns this basic command, I believe it will return 255
print inp(&fb7e)

ikonsgr

Quote from: GL on 16:44, 07 December 23Ok, just for curiosity found why exactly the amsdos stucks at rom initialization

c95e ed78      in      a,(c) ; read FDC main status register
c960 87        add     a,a ; transfer bit 7 ("data ready") to carry
c961 30fb      jr      nc,$c95e     

I tried on my 464 machine FDC main status register (port FB7E) reads value 120 (01111000) so the code can wait forever for my non-existent fdc to be ready :picard:

@ikonsgr and others with 'not hanging' 464's can you test what returns this basic command, I believe it will return 255
print inp(&fb7e)

 Indeed, AMSDOS ROM init function includes "send command byte" routine where the asm code abstract is from, so if FDC emulation is deactivated and an AMSDOS initialize of rom occurs, it will "Stuck" for ever. On my CPC464 inp (&fb7e) retrurns 255 if no fdc is active, otherwise it returns 128 (so doubling this will set carry flag to true and bypass the loop).
Now, can you specify when exactly CPC464 hangs, and what did you do to by pass this hanging? 
Maybe i will try it on my "non hanging" CPC464 and see if it also works ok, and then we can update fw with the modifications.

GL

Quote from: ikonsgr on 20:21, 07 December 23Now, can you specify when exactly CPC464 hangs, and what did you do to by pass this hanging? 
Maybe i will try it on my "non hanging" CPC464 and see if it also works ok, and then we can update fw with the modifications.
The hangs occurred each time on cold boot, and whenever on each reset if there is usb stick connected. So basically it was non-usable with usb flash.

As I wrote I just modified the clc's setup at the beginning of the code. Originally there is CLC5CON = 0x02; which setups CLC5 for FDC emulation, but is in disabled state. I changed it to CLC5CON = 0x82 just to test what happens, and it works for me. I'm sure this is not the proper way to fix the problem. It must be some check before amsdos initialization to test if cpc has real FDC (not sure for all possible real hardware/software configurations). This can be challenging as the amsdos/parados is the first rom which is loaded, possibly modification to the initialization code is needed to check for fdc presence and enable fdc emulation if it's missing.

ikonsgr

Quote from: GL on 21:02, 07 December 23The hangs occurred each time on cold boot, and whenever on each reset if there is usb stick connected. So basically it was non-usable with usb flash.
Does the hang up occurs when you deactivate "auto usb" function too (just give out &fbd1,93)?
If it does, it would be very weird, because amsdos emulation shouldn't be activated upon cold boot (so no FDC emulation would needed either), unless "auto usb" function is activated, which includes the |EN command (that enables emulation for amsdos disc routines, so in a way, it partially activates amsdos).


ikonsgr

@GL, and another possibly important clue: does the led on usb host module goes red before the hang up?
Btw, this is the initialization code for USIfAC REV7:
initialize_routine:
    push    de
    push    hl
;cont_init:
   
    ld    bc,&fbd9
    ld    a,1
    out    (c),a
    ld    a,&FB
        in    a,(&D3)
    cp    "/"
    jr    z,no_clear_path
   
    ld    c,&d1
    ld    a,53
    out    (c),a            ;start of sub dir, 0=no sub dir

no_clear_path:
   
    ld    c,&d4
    ld    hl,&0006
    ld    a,(hl)
    cp    128        ;128=cpc 464, 145=cpc6128
    jr    nz,cpc6128
       
    ld    a,&FB
        in    a,(&DC)
    cp    &83
    jr    z,con464

    cp    120
    jr    z,set464

    LD    a,120
    out    (c),a
    ld    c,&d1
    ld    a,5
    out    (c),a   
    call    restart_464
    jr    con464

set464:
    LD    a,&83
    out    (c),a

    ld    c,&dc
    xor    a
    out    (c),a

    call    enable_usb
    or    a
    jr    nz,con464 ;cpc464_1

    ld    c,&d1
    ld    a,4
    out    (c),a
cpc464_1:
    call    restart_464

con464:
    ld    hl,&be7d
    ld    a,&ff
    ld    (hl),a
    ld    a,&fb
        in    a,(&Df)      ;check if fdc enable
    or    a
    jr    z,end3_init

    call    direct_enable
    ld    bc,&fbd1
    ld    a,4
    out    (c),a
    ld    a,7
    out    (c),a
    dec    a
    out    (c),a
    jr    end6_init

cpc6128:
    LD    a,&66
    out    (c),a
    ld    c,&dc
    xor    a
    out    (c),a
    call    enable_usb   

end3_init:

    ld    a,&FB        ;check if usb_stick enabled
        in    a,(&De)
    or    a
    jr    nz,end7_init

    ld    a,&FB
        in    a,(&D7)
    or    a
    jr    z,end7_init
    ld    bc,&fbd1
    ld    a,51
    out    (c),a
    jr    end8_init
end7_init:
    ld    a,&FB
        in    a,(&D9)      ;check if rom enable
    or    a
    jr    z,end6_init
end8_init:
    call    direct_enable

end6_init:
    ld    hl,init_message
    call    printmessage_loop
    ld    bc,&efc4
    out    (c),c   
    ld    a,&ef
        in    a,(&00)
    cp    1
    jr    z,ram_mode
    cp    2   
    jr    z,rom_mode

    ld    bc,&fbc3
        in    a,(c)
    cp    170        ;ram/rom board present
    jr    z,all_mode

    ld    c,&df   
    ld    a,85        ;no ram/rom board
    out    (c),a
    jr    cont_init    ;no expansion board present


rom_mode:
    ld    hl,extra_rom_msg
    call    printmessage_loop       
    jr    cont_init

all_mode:
    ld    hl,extra_all_msg
    call    printmessage_loop       
    jr    cont_init

ram_mode:
    ld    bc,&fbdf   
    ld    a,170
    out    (c),a
    ld    hl,extra_ram_msg
    call    printmessage_loop

cont_init:

    ld    hl,no_msg
    call    printmessage_loop   
    pop    hl
    pop    de
    scf
    ret

restart_464:
    ld    c,&c3
        in    a,(c)
    ret    nz
    call    0

enable_usb:
    ld    a,&FB        ;check if usb_stick enabled
        in    a,(&De)
    or    a
    ret    nz
enable_usb2:
    ld    a,&FB
        in    a,(&c6)      ;check if auto enable usb is on/off
    or    a
    ret    z
    call    continue_usb
    ld    hl,no_msg2
    call    printmessage_loop   
    ld    a,1
    ret

init_message:
defb " USIfAC II Enhanced (7)",0

extra_ram_msg:
defb " + 512Kb Ram",0

extra_rom_msg:
defb " + 32X Rom Board",0

extra_all_msg:
defb 10,13," + 256Kb Ram + 2X Rom Board",0

Since you got involved pretty "Deep" with the "hang upon cold boot" problem on specific CPC 464, you might be able to make an assumption of where exactly in asm code you think the problem might be?
 It's true that this code, especially after adding the "Auto usb" function, became pretty complex (in order to cover both 6128 & 464,"auto usb" function setting, the existence of extra ram/rom board), so there might be a "glitch" somewhere, although it's pretty weird why this "glitch" appears ONLY with specific CPC 464....  ::)

Brocky

played with the new version of the utility yesterday, it worked as it should this time! no garbage at CPC...so that part seems to be good to go..
still get the error on closing tho, and another error popped up when the cpc disconnected and tried to reconnect (another access violation)

ikonsgr

Ok,i just make some modifications on ULIfAC REV3 firmware.
Now, board boots with FDC emulation active and deactivated after "dual boot" of CPC464 at the end of initialization. I've tried it on both CPC6128 & CPC464 of mine, and it seems to work ok, but as i don't have a "sticky boot" CPC464,i can't tell if it actually resolve the problem.
 So, @GL or anyone else having this weird "hang-up upon boot/reset" on a CPC464, try to update with this firmware (REV3a, for the moment, NOT an official firmware): https://www.dropbox.com/s/buwa93cknc48eiq/ULIFAC_v3a.zip?dl=0
Note this is the plain hex, WITHOUT the bootloader, so you can use either PICKIT to update,or if you have REV3. board, you can use the simpler method with the usb2serial cable too.


d_kef

Just tested rev7a with my USIfAC II and my stubborn 464.
Unfortunately there was no change in the behaviour.
It boots up to the "USIfAC II Enhanced (7)" message, then it reboots and freezes after the Amstrad copyright message.
If I also connect the M4, even with all ROMs and M4 ROM disabled the the USIfAC works perfectly fine!

d_kef

GUNHED

http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

d_kef

No
Quote from: GUNHED on 21:47, 12 December 23So, the USIfAC II ROM can be placed on the M4 expansion too?
No. All ROMs on the M4 are disabled. Also the M4 DOS ROM is disabled. So the M4 is just connected to the CPC bus but it doesn't offer any functionality. Yet, for some reason, it makes the USIfAC boot normally.

d_kef 

GUNHED

http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

ikonsgr

Quote from: d_kef on 20:48, 12 December 23Just tested rev7a with my USIfAC II and my stubborn 464.
Unfortunately there was no change in the behaviour.
It boots up to the "USIfAC II Enhanced (7)" message, then it reboots and freezes after the Amstrad copyright message.
If I also connect the M4, even with all ROMs and M4 ROM disabled the the USIfAC works perfectly fine!
d_kef
That's really unbelievable! With some tests i made in the past, my RAM/ROM board was impossible to boot right with a M4, but now you tell me that this weird "hang on boot" problem with your CPC464 and USIfAC II, it resolves when M4 is also present!  ???  :o
btw, did you try to disable "Auto usb" function (just give OUT &FBD1,93) and see if you still have the same problem?

d_kef

If I disable the auto usb feature or if I boot without the USB installed then it boots normally. Then if I connect and enable the USB running |CAT works but running CAT freezes the CPC.
If I try to mount a dsk file or run any program from the USB it freezes again. And if I press the reset button the CPC reboots to the Amstrad copyright message and then freezes.

d_kef

ikonsgr

Quote from: d_kef on 15:20, 13 December 23If I disable the auto usb feature or if I boot without the USB installed then it boots normally. Then if I connect and enable the USB running |CAT works but running CAT freezes the CPC.
If I try to mount a dsk file or run any program from the USB it freezes again. And if I press the reset button the CPC reboots to the Amstrad copyright message and then freezes.
d_kef

Hmmmm, these symptoms sounds more like a usb stick problem or maybe cooperation of usb host module with the specific usb stick. Did you try other usb sticks? If you still have problems with other usb sticks, then the "culprit" might be the usb host module itself.
Btw,i suppose you already tried the "small partition with fat16" of usb stick, right? I recall that creating a small partition, seemed to help with proper usb functioning.

ikonsgr

Quote from: d_kef on 15:20, 13 December 23if I connect and enable the USB running |CAT works but running CAT freezes the CPC.
This sounds like having "direct file" mode disable. After booting (with "auto usb" disable), you just have to give |USB (no extra |EN commands needed). After that, you should be able to use RUN,CAT,SAVE,LOAD commands directly.
And you can also check current status of various functions at any time, by giving |STAT.

d_kef

The exact same configuration works flawlessly with my 6128.
So I don't think it's the USB drive or the module.
I have also tried with a couple other USB sticks but not with FAT16. I'll give it a try if you think it might work.

About starting with "auto usb" off I only gave |USB after boot. No |EN or other commands. Just |USB and CAT or RUN"xxx and the CPC freezes.

If you think that I could do some other tests that might help or even take a video of the process, I'd be glad to.

d_kef

Powered by SMFPacks Menu Editor Mod