Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 01:41 06 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2: Bug reports

     Page 15 of 17    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 07:19am 19 Jun 2020
Copy link to clipboard 
Print this post

  Quote  No, I don't think it is another timing error at power up. Note that changing back to NORMAL timing (which doesn't work with my SD cards), appears to only take effect at the next power up.
Whereas changing to CONSERVATIVE (from NORMAL) takes immediate effect.

I do agree that there appears to be some strangeness going on with the apparent inconsistencies around reported SD Card support.


Your diagnosis is wrong but your observation may be relevant. Normal and conservative both take effect when you do them. However, the SDcard won't be in the same state depending on whether the power has been cycled. AFAIK most people having SDcard problems are using CGs boards which don't have a power switch. Power on is therefore when you plug in the USB cable which is inevitably going to be noisy and unclean.

Please can you try fitting a power switch to the PCB, just a normal switch on a flying lead will do, set the SD timing to normal and switch on the board with the switch and see what happens.

I have 8 CMM2 with a complete mixture of Y chips V chips, Waveshare and all-in-one PCBs (V2.1 and V1.5 respectively), and like KeepIs numerous different SDcards from 2GB up to 128Gb and they all work perfectly on all CMM2 at normal setting.

For the avoidance of doubt NORMAL mode uses a clock speed of 195.312KHz for initialisation (50MHz / 256) and 25MHz for normal running
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1593
Posted: 07:48am 19 Jun 2020
Copy link to clipboard 
Print this post

That's a good point Peter. Without a switch the supply start up will likely be more noisy and slower. Those with a switch could simulate that by leaving the switch on and powering off and on by the power point switch.

Bill
Keep safe. Live long and prosper.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5914
Posted: 08:07am 19 Jun 2020
Copy link to clipboard 
Print this post

  robert.rozee said  not wanting to fan any flames, but...

what if the "ground pin 40 to reset" functionality was removed, and instead have a full reset triggered in wither of two different ways:

1. hold down shift-1 on an attached USB keyboard while starting up, or,
2. hold down shift-1 ("!") on a terminal set to 115k and attached to the serial console?

ie, in much the same was as can be done with an MX170 micromite.

with methods 1. and 2. available, would this not cover every possible base? if the scan codes are used from the USB keyboard, it wouldn't matter what language was printed on the keytops - as far as i am aware, both the shift and "1" keys return the same scan codes irrespective of language (the "1" key may have a different shifted character printed on it, but this is unimportant). and the string of "!" characters from the serial console is there as a backup.

my feeling is that having a simple level-triggered 'master reset' input attached to what may be an undefined length of ribbon cable is, well, not the best ideal.


cheers,
rob   :-)


To test the CMM2s long line capabilities, I add extra capacitance to the pin 40 and turned on.
First with 250mm IDE ribbon cable into a breadboard:



Next as above plus 39pF



Next as above but 0.01uF



Finally 0.22uF



The ringing is most likely the switch bouncing. It occurred with all capacitors and only some times.

In all cases, the spike in voltage on the pin was fully ended in 500uS
The startup sequence now checks 3 times at 100mS intervals so I don't think long lead capacitance is going to cause any problems.

Re your option 2.
The serial port only comes on when power is applied so it would be difficult to send anything during port enumeration.

Jim
VK7JH
MMedit   MMBasic Help
 
KeepIS

Guru

Joined: 13/10/2014
Location: Australia
Posts: 1373
Posted: 08:19am 19 Jun 2020
Copy link to clipboard 
Print this post

For what this is worth:

I don't have a power switch, the board just powers up with USB, or when I plug into the port.

HOWEVER:

My SD card holder, running from USB 5v in, has a 3v3 regulator with filter caps, so at power up via USB it's getting a clean power state, and like Peter, every SD card I throw at it works.

EDIT: Been a while since I looked at the Schematic, but the SD card holder in the supplied units is also run from the CPU 3.3v regulator, so unless there is some instability there (and I see none from mine) there may be another issue.  
.
.
Edited 2020-06-19 19:16 by KeepIS
It's all too hard.
Mike.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3850
Posted: 09:09am 19 Jun 2020
Copy link to clipboard 
Print this post

  TassyJim said  If you want to accept the function keys (and others), use INKEY$

Jim


Thanks Jim,

My bug report wasn't because I can't read the function keys it was about not having them behave in undesireable or unexpected ways (I noticed because I have an unfortunate tendency to hit F11 on the Logitech K270 when I'm reaching for the Backspace).

I believe the current behaviour is undesireable because the Fn key definitions are specific to things the user might want to do at the command prompt and are unlikely to want to do from within a running BASIC program ... though perhaps if they were all programmatically defineable (with a command extension of OPTION to return them to their defaults) then that could be a useful feature.

I believe the current behaviour is unexpected because the Fn keys don't even behave the same as they do at the command prompt, c.f. F10-12. I have a suspicion they are producing the output expected from an earlier 'mite.

Regards,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
GregZone
Senior Member

Joined: 22/05/2020
Location: New Zealand
Posts: 114
Posted: 10:00am 19 Jun 2020
Copy link to clipboard 
Print this post

  matherp said  AFAIK most people having SDcard problems are using CGs boards which don't have a power switch. Power on is therefore when you plug in the USB cable which is inevitably going to be noisy and unclean.

Please can you try fitting a power switch to the PCB, just a normal switch on a flying lead will do, set the SD timing to normal and switch on the board with the switch and see what happens.

This is an interesting observation. Just acknowledging I've seen your request, but it's getting late so I'll give this a try in the morning and report back.
 
GregZone
Senior Member

Joined: 22/05/2020
Location: New Zealand
Posts: 114
Posted: 10:10am 19 Jun 2020
Copy link to clipboard 
Print this post

  TassyJim said  To test the CMM2s long line capabilities, I add extra capacitance to the pin 40 and turned on.

Nice work Jim.  I had considered doing the same observations, but after confirming with the datasheet that the internal pull-ups are nominally 40K, and knowing that likely PCB capacitance would only be in the 10's of pf, some maths told me that the slew rate would be (at worst) in the order of 10's of microseconds.  ie. Certainly well within the 100ms settling delay that was coded.
So it remains a bit of a curiosity what is actually going on here.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3850
Posted: 11:08am 19 Jun 2020
Copy link to clipboard 
Print this post

Dear Peter,

Apologies for resurrecting this from 7 pages past:

I have this problem demonstrated by Z-MIM Release 1:

1. Start minizork
2. Type "restart" and "Y" to confirm
3. Start minizork
4. Type "quit" and "Y" to confirm

You get the error:
[execute:24] Error: EXEC is not declared

which is decidedly odd because execute:24 is inside the EXEC function.

I believe this is because "restart" is implemented simply as a call to "RUN" to re-run the current program and that the new instance is "troubled" so it misbehaves when it ENDs.

I think you said this is legal, if inefficient, in which case it looks like the above demonstrates a firmware bug.

Is this something you might look at and fix? or should I just rewrite so I don't need to call RUN? which I might end up doing anyway.

Best regards,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 12:01pm 19 Jun 2020
Copy link to clipboard 
Print this post

  Quote  Is this something you might look at and fix?


Not without a much simpler example. My little test version below works perfectly. Really I need something that fails that I could also run on a MM2.

a=exec( 1)
run

function exec(a) as float
local b,c
exec=3
if exec=3 then print "hello"
end function

Edited 2020-06-19 22:04 by matherp
 
zeitfest
Guru

Joined: 31/07/2019
Location: Australia
Posts: 388
Posted: 12:19pm 19 Jun 2020
Copy link to clipboard 
Print this post

Any illumination on this ?

[ Not being expert in the two Basic argots ...I am assuming that both show problems ie GW not handling line 6 fully and MM ditching at 7 / 8 (?) ]



  robert.rozee said  well, this is embarrassing...

using gw-basic 3.23, running under DosBox:

110 For i=0 To 1
120   Print "example " i+1 ":"
130   If i Then Print ,, "green eggs ";: Print "on ham"
140 Next i
150 '
160 For i=0 To 1
170   Print "example " i+3 ":"
180  If i Then Print ,, "oxfords" Else Print ,, "brouges"
190 Next i
200 '
210 For i=0 To 1
220   Print "example " i+5 ":"
230   If i Then Print ,, "jam on "; Else Print ,, "french ";: Print "toast"
240 Next i
250 rem '
255 ?
260 For i=0 To 1
270   Print "example " i+7 ":"
280   If i Then Print ,, "1st ";: ? "2nd" Else Print ,, "3rd ";: Print "4th"
290 Next i


we get the following output:

example  1 :
example  2 :
                           green eggs on ham
example  3 :
                           brouges
example  4 :
                           oxfords
example  5 :
                           french toast
example  6 :
                           jam on
example  7 :
                           3rd 4th
example  8 :
                           1st 2nd
Ok


whereas micromite basic running on an MX170 gives:

> RUN
example  1:
example  2:
               green eggs on ham
example  3:
               brouges
example  4:
               oxfords
example  5:
               french toast
example  6:
               jam on toast

example  7:
example  8:
               1st
[19] 280   If i Then Print ,, "1st ";: Print "2nd" Else Print ,, "3rd ";: Print
"4th"
Error: Expected closing bracket
>


note the deviation of example 6, that is NOT syntactically incorrect.

one might speculate that the origins of the discrepancy lay in code written by Mrs Verda Spell, whose premature departure from this mortal plane prevented her completing the implementation of single line if-then-else. but then, i couldn't possibly comment!


cheers,
rob   :-)
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2290
Posted: 12:50pm 19 Jun 2020
Copy link to clipboard 
Print this post

  zeitfest said  Any illumination on this ?
[ Not being expert in the two Basic argots ...I am assuming that both show problems ie GW not handling line 6 fully and MM ditching at 7 / 8 (?) ]


my assumption is that GW-basic is canonical, however the MMbasic deviation is actually more useful in practice, allowing for the rather useful 'jam on toast' case.

the end result, there are THREE if-then[-else] variants in MMbasic:

1. IF conditional THEN statements
(no else, all statements after THEN are executed if conditional is true)

2. IF conditional THEN statement1 ELSE statement2 [: other_statements]
(conditional true: execute statement1,
conditional false: execute statement2,
in both cases, always execute other_statements if present,
no more than one statement is allowed between THEN and ELSE)

3. multi-line if-then-else


the latest CMM2 manual kind-of-mostly explains this.


cheers,
rob   :-)
Edited 2020-06-19 22:54 by robert.rozee
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3850
Posted: 12:56pm 19 Jun 2020
Copy link to clipboard 
Print this post

Dear Peter,

Try this for size:
Function exec(a) As Float
 Local s$

 Do
   Line Input "Run again [y|n] ", s$
   s$ = LCase$(s$)
 Loop Until s$ = "y" Or s$ = "n"

 If s$ = "y" Then Run

 exec = 1
End Function

Sub main()
 Cls
 a = exec(1)
End Sub

main()


Run and answer "y" followed by "n" to get this error:
[17] Error: Nothing to return to


It's not the same error message, but it has the same "feel" of the interpreter having lost context so I suspect it's the same issue.

Regards,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 12:57pm 19 Jun 2020
Copy link to clipboard 
Print this post

Robert's explanation is entirely correct. The remaining issue which I've discussed with Geoff is that invalid versions are not always errored as you might expect and he is intending to look at this in the future.

Of course the easy way round all this if you really want one line is to use

IF conditional then : statements : else : statements : endif
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2290
Posted: 01:08pm 19 Jun 2020
Copy link to clipboard 
Print this post

  TassyJim said  Re your option 2.
The serial port only comes on when power is applied so it would be difficult to send anything during port enumeration.

Jim


good point, i'm forgetting that most micromites have a reset switch to facilitate this. i guess it is a little late to add a reset switch to the CMM2?    

1. can/does the H7 processor sit idling in a low-power state for any length of time after powered is applied, to allow for enumeration to complete? i believe there exists no way for the H7 to tell when enumeration is finished.

2. prior to enumeration, how much power is available from a standard USB port with
(a) a 1455 fitted,
(b) a 2221 fitted,
(c) neither fitted?

3. and how much power does a 2221 request? as i recall, the 1455 requests 100mA. is this sufficient for (most)every SD card that is likely to be encountered these days?

4. i note that the power switch is wired up on geoff's schematic BEFORE the 1455/2221. is this true to the actual PCBs? both the 1455 and 2221 can be configured to operate from 5v USB power using their internal 3v3 regulator, which would allow enumeration prior to powering the waveshare module.


cheers,
rob   :-)


addendum:
just went back to the 'Introducing the Colour Maximite 2' thread, the first post describing the CMM2 states:
" - Power is 5 volts at 170mA typical (ie, from an USB port or charger)."

this is going to be a problem, with a fully compliant USB port things will go wrong if a 1455 or 2221 is fitted. it may be ok with the 1455/2221 removed, ie no enumeration occurring, but the USB documentation isn't exactly clear about this.

the 2221 seems to default to 100mA max USB power draw, but this can be reconfigured later on, for up to 500mA using a utility supplied by microchip. as i remember, the 1455 is hard-coded to 100mA.

my advice is to either remove the 1455/2221, or reconfigure the 2221 to request 300mA or more using the microchip utility. however, even with the 2221 reconfigured, this does not solve the issue of the CMM2 drawing 170mA while the 2221 is enumerating.
Edited 2020-06-20 01:03 by robert.rozee
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 03:18pm 19 Jun 2020
Copy link to clipboard 
Print this post

Rob

Thanks for the very useful input - AGAIN

Microbridge request 500mA.

The CMM2 doesn't use 170mA until all initialisation has happened. Starting current is about 43mA. If necessary I can introduce a delay before the clocks are wound up to allow more time for enumeration of the USB/UART but this doesn't seem to have been an issue thus far.
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2290
Posted: 03:29pm 19 Jun 2020
Copy link to clipboard 
Print this post

hi peter,
   i just checked a 'microbridge' with V1.18 firmware (the latest?), and under linux it reports:

user@HP-stream11-392758:~$ lsusb -s 10 -v
...
MaxPower              100mA
...


does the 1455 offer any real advantage over a 2221A in the CMM2? icsp programming isn't useful with the H7 processor, and the only other material thing different is the 1455 offering the ability to maybe translate break->reset, which is a pretty minor feature outside of a micromite.


cheers,
rob   :-)
Edited 2020-06-20 01:31 by robert.rozee
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 03:50pm 19 Jun 2020
Copy link to clipboard 
Print this post

  Quote  does the 1455 offer any real advantage over a 2221A in the CMM2


Price

From the Microbridge code

static const ROMPTR struct configuration_1_packet configuration_1 =
{
{
// Members from struct configuration_descriptor
sizeof(struct configuration_descriptor),
DESC_CONFIGURATION,
sizeof(configuration_1), // wTotalLength (length of the whole packet)
2, // bNumInterfaces
1, // bConfigurationValue
2, // iConfiguration (index of string descriptor)
0b10000000,
500/2,   // 100/2 indicates 100mA
},

Edited 2020-06-20 04:03 by matherp
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1083
Posted: 06:07pm 19 Jun 2020
Copy link to clipboard 
Print this post

Something is strange with the circle command and the colour black.

From the command prompt:
cls rgb(gray)
box 50,200,200,200,1,rgb(black),rgb(black)
circle 400,300,100,1,1,rgb(black),rgb(black)

Where is that black circle?

Changing the colour used in the circle command gives expected results.

edit: sorry, version 5.05.03b1j, Waveshare based CircuitGizmo CMM2
Edited 2020-06-20 04:08 by vegipete
Visit Vegipete's *Mite Library for cool programs.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8592
Posted: 06:16pm 19 Jun 2020
Copy link to clipboard 
Print this post

  Quote  Where is that black circle?


Good question. As a workround use RGB(1,1,1) while I find out
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1083
Posted: 06:20pm 19 Jun 2020
Copy link to clipboard 
Print this post

  matherp said  Good question. As a workround use RGB(1,1,1) while I find out

No rush. I would like colour 0 so I can figure something out with sprites and transparency.
Visit Vegipete's *Mite Library for cool programs.
 
     Page 15 of 17    
Print this page
© JAQ Software 2024