Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 03:43 20 Apr 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 : MM+ v5.05.02  - CPU exception #7 with E64

Author Message
erbp
Senior Member

Joined: 03/05/2016
Location: Australia
Posts: 186
Posted: 04:02am 16 Mar 2020
Copy link to clipboard 
Print this post

Hi,

I am not sure if this is a bug or I have a problem with my E64.

The situation I have is an early model E64 (version 1C) which I am using with an external SDCard holder/module connected in parallel to the onboard micro SDCard holder on the E64. The external module supports a Write Protect pin (which as far as I know the onboard module doesn't). So I configure the SDCard with OPTION SDCARD 12,14,-23  - having the WP pin connected to MM+ pin 23 and requiring the polarity of the WP signal to be inverted.

With this configuration I can access the SDCard successfully except for when I try to OPEN a file for OUTPUT, APPEND or RANDOM - these all cause the same error : CPU exception #7 (bus error on load or store) at address 0x9D049AB8. These open modes will all require the Write Protect status to be checked. OPEN for INPUT works fine.

Now if I leave off the WP pin from the configuration (so just OPTION SDCARD 12,14) everything works OK, no CPU exception for any file access mode.  Also if I specify the WP pin without the negative sign, again no CPU exception, but of course if I try to open a file for OUTPUT, APPEND or RANDOM, MMBasic reports that the SDCard is write protected.

I have tried re-flashing the E64 multiple times - no change to the problem. I have also tried a few different MM+ pins for the WP signal, again no effect.

Now the really confusing bit is that I also have an E100 using the same model external SDCard holder/module and with the SDCard configured as OPTION SDCARD 52,53,-17 and no problems with CPU exceptions. It is quite happy to allow files to be opened for OUTPUT, APPEND or RANDOM!!

Unfortunately I don't have a second E64 module so I can't try a different CPU chip to see if that is where the problem lies. Can anyone test this or shed any light as to whether this is a bug that affects specifically the 64 pin MM+?

Thanks,
Phil.
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 425
Posted: 05:09am 16 Mar 2020
Copy link to clipboard 
Print this post

hi erbp
I put here 2 schemas, one for E64 and other for E100. You can see that SdCard are not sames, in E64 there is no WP signal, only CE and CD.

I think that your problem is here

explorers_sch.zip
 
erbp
Senior Member

Joined: 03/05/2016
Location: Australia
Posts: 186
Posted: 09:48am 16 Mar 2020
Copy link to clipboard 
Print this post

Hi goc30,

Yes and No - Yes, I agree that the E64 module does not support the WP signal. That is because it has a Micro SDCard holder fitted and Micro SDCards do not support Write Protection. So the PCB has no track for WP, nor is there a pin assigned on the CPU chip.

No, because I am not using the Micro SDCard holder fitted to the E64 board. I have a standard size SDCard holder fitted to an EXTERNAL module. This holder DOES support Write Protection and has a WP pin on its interface. Below is a partial image of the schematic showing how my external SDCard is connected to the E64.


The Micromite Plus Manual v5.05.02 page 19 shows that the OPTION SDCARD command includes the WP pin specification as an option. No where that I can find does it state that use of the WP pin is unsupported on the E64. I should therefore be able to connect the WP signal to any spare pin on the CPU and specify that pin in the OPTION SDCARD command.

So I don't think this is the answer.  

Phil.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9051
Posted: 05:38am 19 Mar 2020
Copy link to clipboard 
Print this post

I suspect you are trying to configure the SD card for the new arrangement, when it has already been configured for the on-board socket.  This will most likely cause CPU exceptions.

I would try OPTION SDCARD DISABLE(from the command-prompt) first, to disable the SD card as known by the E64.  I would then cycle power.
NOW, issue your NEW SD card command.  I expect that is where the problem is.

The E64 was not designed to use an external SD card holder.
You are technically supposed to use the on-board uSD socket if you want to use an SD card at all.

Let us know if the above helps at all.
Smoke makes things work. When the smoke gets out, it stops!
 
erbp
Senior Member

Joined: 03/05/2016
Location: Australia
Posts: 186
Posted: 08:52am 19 Mar 2020
Copy link to clipboard 
Print this post

  Grogster said  I would try OPTION SDCARD DISABLE(from the command-prompt) first, to disable the SD card as known by the E64.  I would then cycle power.
NOW, issue your NEW SD card command.  I expect that is where the problem is.


Hi Grogs,

Ah, if it were only that easy!  I guess I should have been more specific with my explanation. I already do the OPTION SDCARD DISABLE BEFORE attempting the OPTION SDCARD 12, 14, -23. The CPU exception doesn't happen at the time of setting the OPTION - it is accepted quite happily and reports correctly via a subsequent OPTION LIST. What is more I can use SDCard commands like FILES and CHDIR successfully, I can even OPEN an existing file FOR INPUT and read data from it. The CPU exception only occurs when I try to OPEN a file FOR OUTPUT, FOR APPEND or FOR RANDOM.

Anyway thanks for the suggestion.  

Phil.

BTW it is not a show stopper, as I can simply not specify the WP pin, then everything works normally. I don't think the Write Protection feature is that important for me. My prime reason for using an external SDCard holder is that when I finish this project the E64 will be shut away inside a case with no access to the on-board SDCard holder.
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 425
Posted: 04:20am 20 Mar 2020
Copy link to clipboard 
Print this post

hi
I don't understand your problème. If you need to use WP signal, you can programm this signal as normal input. Before writing in Sd, you read WP and accept or not writing function
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9051
Posted: 04:34am 20 Mar 2020
Copy link to clipboard 
Print this post

@ erpb: I wonder if the -23 thing(the inverted pin thing you mentioned in your first post) is the cause?  Perhaps that WAS a supported feature in the past, but in the more recent firmwares, perhaps you HAVE to use positive integer numbers, and cannot specify a pin like that.  Personally, I have never ever tried to use a minus number for a pin reference.  Perhaps you CAN with some features, but perhaps NOT with the SD card.

If Geoff or Peter(matherp) read this, they might throw some light on that.

@ goc30: The problem he is having, is that the configuration he is trying to use is causing a CPU exception - the MCU core essentially crashes, and the hardware forces a restart.  This should never happen in normal circumstances.
Smoke makes things work. When the smoke gets out, it stops!
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 425
Posted: 04:44am 20 Mar 2020
Copy link to clipboard 
Print this post

  Grogster said  

@ goc30: The problem he is having, is that the configuration he is trying to use is causing a CPU exception - the MCU core essentially crashes, and the hardware forces a restart.  This should never happen in normal circumstances.


ok I understand.
May be is it a programming pb , or interrupt timming   (port 23 is also count port), or....hardware
 
erbp
Senior Member

Joined: 03/05/2016
Location: Australia
Posts: 186
Posted: 05:18am 20 Mar 2020
Copy link to clipboard 
Print this post

  Grogster said  @ erpb: I wonder if the -23 thing(the inverted pin thing you mentioned in your first post) is the cause?  Perhaps that WAS a supported feature in the past, but in the more recent firmwares, perhaps you HAVE to use positive integer numbers, and cannot specify a pin like that.  Personally, I have never ever tried to use a minus number for a pin reference.  Perhaps you CAN with some features, but perhaps NOT with the SD card.

If Geoff or Peter(matherp) read this, they might throw some light on that.


Hi Grogs,

Yes it is most definitely related to the WP pin being specified as a negative number! I thought I had stated this in a previous post. If I specify OPTION SDCARD 12,14,23 - i.e. NOT inverting the WP signal, the CPU Exception does NOT occur. In this case however MMBasic will report an error for any attempt to write to the SDCard as it 'thinks' the card is Write Disabled which is to be expected.

As for whether the pin number can be specified as a negative to imply signal inversion - the following is an extract from the Micromite Plus manual - v5.05.02 (my highlighting).



@goc30 - I don't have a problem, my concern was that maybe there is a bug in the MMBasic firmware. If so, for some strange reason, it only shows up on the 64 pin MX470, as I use the negative WP pin configuration successfully on an E100 module or maybe my 64 pin MX470 chip is damaged in some way (I only have one, so nothing to compare against).

EDIT: I have tried other pins for the WP signal, not only 23. 

Phil.
Edited 2020-03-20 15:19 by erbp
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 425
Posted: 07:52am 20 Mar 2020
Copy link to clipboard 
Print this post

i have explorer64, but i don't know if i have a SDCard with WP signal. I'm going to look in my cases. If I found it, I test your pb
 
erbp
Senior Member

Joined: 03/05/2016
Location: Australia
Posts: 186
Posted: 09:00am 20 Mar 2020
Copy link to clipboard 
Print this post

Hi goc30,

Thanks. Actually you don't need a SD Card Holder that provides a WP signal to test this - you can use the E64 on-board Micro SDCard and emulate the WP signal. Follow the steps below if you want to try this out.

1. Identify a spare pin on the E64 and jumper this pin to GROUND. This emulates the WP signal from a SD Card that is Write ENABLED but in a holder that inverts the WP signal.

2. Via the Command Prompt - enter OPTION SDCARD DISABLE. Optionally cycle the power after doing this.

3. Via the Command Prompt - enter OPTION SDCARD 12, 14, -<pin # selected in step 1>. Make sure the WP pin # is entered as a NEGATIVE value. Optionally power cycle again.

4. Insert a Micro SDCard into the E64 Micro SDCard holder.

5. Via the Command Prompt - enter FILES. You should get the list of folders and files on the  A:\ drive, if any. Note the names of any files (so you can choose a non-existing file name in the next step).

6. Via the Command Prompt - enter OPEN "<new file name>" FOR OUTPUT AS #2. Choose a non-existing file name in place of <new file name>.

This is where the system crashes with the CPU Exception for me. If the file opens successfully, then there is not a firmware bug, so that would prove that my 64 pin MX470 must be defective.

Thanks for your help.
Regards,
Phil.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9051
Posted: 12:00am 21 Mar 2020
Copy link to clipboard 
Print this post

I normally spend Saturday with mother driving around etc, but her rest-home is in lockdown cos of the virus threat - understandable.  Therefore, I have some spare time today I did not think I would have, so I will also dig out an E64 and do the steps above and report what I find.
Smoke makes things work. When the smoke gets out, it stops!
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 425
Posted: 02:54am 22 Mar 2020
Copy link to clipboard 
Print this post

Hi
  erbp said  Hi goc30,

Thanks. Actually you don't need a SD Card Holder that provides a WP signal to test this - you can use the E64 on-board Micro SDCard and emulate the WP signal. Follow the steps below if you want to try this out.

...

Phil.


I do what you ask, and I have same result as  you

my prog


'option sdcard 12,14,-18

const pinrel=31  'I have led on this pin
dim i as integer
setpin pinrel,DOUT
Pin(pinrel)=1
SetTick 500, task1,1    ' tache de base a faire toutes les 10ms  utile pour eteindre led de signalisation
open "tests.txt" for output as #2
do
i=1
pause(100)
loop


sub task1()
pin(pinrel)=(pin(pinrel) xor 1)
end sub


first "Files" function is good
but after "run" I receive error msg


CPU exception #4 (address error on load or ifetch) at address 0x9D049AB8
Processor restarted



without pin18, it work correctly
Edited 2020-03-22 12:56 by goc30
 
erbp
Senior Member

Joined: 03/05/2016
Location: Australia
Posts: 186
Posted: 07:24am 22 Mar 2020
Copy link to clipboard 
Print this post

  goc30 said  

I do what you ask, and I have same result as  you

first "Files" function is good
but after "run" I receive error msg


CPU exception #4 (address error on load or ifetch) at address 0x9D049AB8
Processor restarted



without pin18, it work correctly


Hi goc30,

Thank you VERY much for testing this out.

I think we can now say that there is a bug in the MM+ firmware around this particular situation (also that I am not daft and my E64 is not defective ).

Maybe Geoff will read this and can investigate it for a potential fix in a future release. I think there are sufficient details in the posts above to reproduce the problem without too much difficulty.

Thanks again.
Cheers,
Phil.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8567
Posted: 08:31am 22 Mar 2020
Copy link to clipboard 
Print this post

Just looked at the code and there is nothing to differentiate 64 and 100-pin functionality and the code is both simple, appears correct and identical to that for the CD pin.
Does it definitely work on 100pin? Does it fail on 64-pin with different pin numbers?
 
erbp
Senior Member

Joined: 03/05/2016
Location: Australia
Posts: 186
Posted: 09:48am 22 Mar 2020
Copy link to clipboard 
Print this post

@ Matherp

Yes, E100 works fine with a negative WP pin # specified. I am using OPTION SDCARD 52,53,-17 on my E100. I just verified that I can OPEN FOR OUTPUT and WRITE to a file on the SDCard when the card is write enabled. If I flip the "Lock switch" on the card to make it write disabled, when I try to do an OPEN FOR OUTPUT I get the MMBasic error "Error: SD card is write protected". All exactly as it should be and not a CPU Exception is sight!!

Note 2 things:-

1. The problem only occurs on the E64 when the WP pin is NEGATIVE. There is no CPU exception if the WP pin is a POSITIVE value.

2. I have NOT tried a negative value for the CD pin. Apparently the SD Card holder that I have does not invert this signal, as CD seems to work properly when specified as a positive value.

I have tried several different pins on the E64 for WP - from memory pin 18 and 23, possibly I tried others at various times as well. In my case there was no difference when using different pin numbers.

I am not able to try specifying a negative CD pin on the E64 right now as I am in the middle of some other testing. If I get time tomorrow I will try that, also a few more pin numbers for the WP pin. Will advise results of any tests I do.

Regards,
Phil.
 
Lightrock
Newbie

Joined: 19/05/2014
Location: Australia
Posts: 26
Posted: 10:23am 22 Mar 2020
Copy link to clipboard 
Print this post

I ran the new SD card routine for SP1 on a 28 pin MM2 Backpack with a ILI9341 LCD and integral SD card reader(class 10 32GB card used) after finding the initial problem was a bad connection to the SD card.
I used the SDTest program (from the original SD card release?).
The program ran and displayed the directory listing and then failed with the message "CPU exception #7 in CFunction at address0x9D00E604. Processor restarted".
The processor was cleared before the CFunction was loaded and the power cycled. The MM.Startup file only had SDcard 0,9,10. Slow speed was for testing during initial fault.
Is this a related issue? I will continue testing with other units, speed and SDcards.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8567
Posted: 11:46am 22 Mar 2020
Copy link to clipboard 
Print this post

  Quote  MM.Startup file only had SDcard 0,9,10. Slow speed was for testing during initial fault.
Is this a related issue? I will continue testing with other units, speed and SDcards.


0 is the fastest speed not the slowest - see the latest post. This isn't related.
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024