Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

problem with mmc and atmega128

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR-DOS
View previous topic :: View next topic  
Author Message
tanus1010

Bascom Member



Joined: 29 Jan 2009
Posts: 6

blank.gif
PostPosted: Fri Mar 13, 2009 4:22 pm    Post subject: problem with mmc and atmega128 Reply with quote

I am using Atmega 128 and mmc.
I have used Lcd on port c . My code is as follows


$regfile = "M128def.dat"
$crystal = 8000000

$swstack = 128
$hwstack = 128
$framesize = 128

'-----------------------------------------------------------------------------------
'-----------------------------------------------------------------------------------

Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = High , Phase = 0 , Clockrate = 4 , Noss = 1
Spiinit

Config Portc = Output

Config Lcd = 16 * 2 'configure lcd screen
Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E = Portc.3 , Rs = Portc.2

'----------------------------------------------------------------------------------
'----------------------------------------------------------------------------------
Cls

Waitms 500
Upperline
Lcd "Hello world"
Lowerline
Lcd "lcd working"

'------------------------------------------------------------------------------

$include "CONFIG_AVR-DOS.bas"
$include "Config_MMC.bas"
$lib "Mmc.lbx"

If Gbdriveerror <> 0 Then
Cls
Lcd "Err in Config"
Locate 2 , 1
Lcd Gbdriveerror
End
Else
Cls
Lcd "Config Init."
End If



The LCD shows Hello world and LCd working but nothing after that.
Even I tried to include :
$include "CONFIG_AVR-DOS.bas"
$include "Config_MMC.bas"
$lib "Mmc.lbx"
before printing anything on lcd. In that case, nothing is displayed on the LCD.

Dont know wats the problem. MMC is getting 3.2 volt.
Please help.
Back to top
View user's profile
oe9vfj

Moderator



Joined: 17 Jun 2004
Posts: 269
Location: Austria, Hard

austria.gif
PostPosted: Wed Mar 25, 2009 9:51 am    Post subject: Reply with quote

The MMC/SD Card uses SPI and you have defined SPI too in your aplication with a different mode (PHASE). I think, BASCOM will take first SPI configuration and work with them, so the MMC/SD will not work, because there is a wrong SPI Configuration for them.
If you need a different SPI Configuration for your Application, check the SOFT-SPI ability of the MMC/SD driver.

_________________
regards Josef

DOS - File System for BASCOM-AVR on http://members.aon.at/voegel
Back to top
View user's profile Visit poster's website
benoit

Bascom Member



Joined: 24 Jul 2007
Posts: 177

france.gif
PostPosted: Sun Mar 29, 2009 7:12 pm    Post subject: Reply with quote

HI

YES WHAT IS YOUR Config_MMC.bas
COULD YOU POST THE SPI CONFIG of Config_MMC.bas
thank s
Back to top
View user's profile
benoit

Bascom Member



Joined: 24 Jul 2007
Posts: 177

france.gif
PostPosted: Sun Mar 29, 2009 7:18 pm    Post subject: Reply with quote

hi
for information you also got a END statement in the middle of your program in the if then endif condition

If Gbdriveerror <> 0 Then
Cls
Lcd "Err in Config"
Locate 2 , 1
Lcd Gbdriveerror
End <----------------------------here
Else
Cls
Lcd "Config Init."
End If

i don t know how bascom will react at this ?
Back to top
View user's profile
benoit

Bascom Member



Joined: 24 Jul 2007
Posts: 177

france.gif
PostPosted: Sun Mar 29, 2009 7:27 pm    Post subject: Reply with quote

HI
for then end in the if then else it is not a ploblem, it work correctly
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR-DOS All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum