Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Ss parameter on SPI slave - AVR128DA28 chip -

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR XTINY/MEGAX/AVRX
View previous topic :: View next topic  
Author Message
maurineri

Bascom Member



Joined: 03 Aug 2006
Posts: 17
Location: Italy

italy.gif
PostPosted: Thu Nov 13, 2025 11:14 am    Post subject: Ss parameter on SPI slave - AVR128DA28 chip - Reply with quote

Hi ,
I have strange error on SPI slave configuration when I try to initialize Ss pin on AVR128DA28 chip
This is the sample code for Slave:

Code:

                                             ' === SPI Slave AVR128DA28 - Bascom Test ===
$regfile = "avrx128da28.dat"
$crystal = 24000000
$hwstack = 32
$swstack = 32
$framesize = 16

Config Base = 0

' Oscillatore e UART
Config Osc = Enabled , Frequency = 24mhz
Config Sysclock = Int_osc , Prescale = 1
Config Com1 = 115200 , Mode = Asynchroneous , Parity = None , Databits = 8 , Stopbits = 1

' Variabili
Dim Bsend As Byte
Dim B As Byte
Dim Rbit As Byte

' SPI0 config in slave mode
Config Spi0 = Hard , Clockdiv = Clk2 , Data_order = Msb , Master = No ',Ss = PORTA.7  << Ss setting produce error .. why ?
Config PortA.5 = Output       ' PA5 = MISO
Spiinit

' Abilita interrupt SPI0
Enable Spi0_Int , Lo
On Spi0_Int Spi0_isr Nosave
Enable Interrupts

' Dati SPI iniziali

Print "SPI slave start"
SPI0_DATA = 1

' Loop principale
Do
   If Rbit <> 0 Then
      Incr Bsend
      Print "TX to master = " ; Bsend ; "  RX from master = " ; B
      Rbit = 0
   End If
Loop

End

' ISR per SPI0
Spi0_isr:
!  push r24
!  in r24,sreg
!  push r24
   B = SPI0_DATA
   SPI0_DATA = Bsend
   Rbit = 1
   SPI0_INTFLAGS = &H80        ' SPI_IF_bm (bit 7)
!  pop r24
!  out sreg,r24
!  pop r24
Return
 


Code work but if I try to initializa Ss pin I get error.. can you help me , please ?

(Compiled with BASCOM AVR 2.0.8.6)

maurizio
Back to top
View user's profile Visit poster's website
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2361

blank.gif
PostPosted: Thu Nov 13, 2025 3:14 pm    Post subject: Reply with quote

The parameter Ss in Config Spin for XTiny only allows for NONE/AUTO, but not for a portpin.
Back to top
View user's profile
maurineri

Bascom Member



Joined: 03 Aug 2006
Posts: 17
Location: Italy

italy.gif
PostPosted: Thu Nov 13, 2025 3:19 pm    Post subject: Reply with quote

MWS wrote:
The parameter Ss in Config Spin for XTiny only allows for NONE/AUTO, but not for a portpin.


ops.. thank you MWS , I will manage Ss by hand..
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR XTINY/MEGAX/AVRX All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can 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