Main Menu
Counter
This page today ...
total: 0
unique: 0

This page ever ...
total: 222
unique: 153

Site ...
total: 4319
unique: 2497
Online
  • Guests: 4
  • Members: 0
  • Newest Member: ole
  • Most ever online: 170
    Guests: 170, Members: 0 on Sunday 15 January 2023 - 07:39:26
Chatbox
You must be logged in to post comments on this site - please either log in from the Login box or from here.If you are not registered click here to signup.


bullet Kim
5 years ago
test
Royalsystems blog

MCS Electronics Forum

  • BASCOM-AVR : UPDI : REPLY



    Above Mark asked about the SNAP V1 and V2 VIDs.

    I have both SNAP versions.
    The new SNAP V2 has a small 3-Pin header on the SNAP PCB.
    Shorting 1 and 2 is for PICs.
    Shorting 2 and 3 is for AVRs.

    I've used my SNAP V2 for SPI so far, but I've not yet tested it on an Xmega (PDI), or a UPDI chip.

    When I plug the V1 and V2 SNAPs into my Windows PC, I see the following VID info in the Device Manager.

    The LEFT info is V2, the RIGHT info is the V1 SNAP.

    JC

    [img:fe3a80f722]https://www.mcselec.com/userpix/8443_20250102_224919_B_1.jpg[/img:fe3a80f722]
    [img:fe3a80f722]https://www.mcselec.com/userpix/8443_SNAP_V2_on_L_V1_on_R_VIDs_1.jpg[/img:fe3a80f722]

  • BASCOM-AVR : UPDI : REPLY



    [quote:14703ece8d="programmista123"]Hi,

    Could you share programmer options screenshot?
    Do you have any errors?[/quote:14703ece8d]

    Screenshots are attached. The error is the same with all other option settings (DTR-pin, RTS-Pin >> program/data,HV program, NONE)

  • BASCOM-AVR : UPDI : REPLY



    It is nomather if it is faster.
    When you lock AVR with UPDI you need a 12V pulse to unlock it.
    I think even SNAP cant do that.

    On the shop site there is a link to oryginal design for this tool. 12V pulse is controlled by RTS signal. It must be low to drive PNP transistor.
    Bascom can handle both DTR and RTS signals but only DTR can be inverted.
    I dont know on which state is RTS signal "normally".
    Maybe there is a permanent low state and this tool inject 12V over that PNP transistor so communication cannot be established.

    Regardless I order one this little baby for tests cheesey

  • BASCOM-AVR : Atmega328pb TWI slave and master : REPLY



    you need to merge the samples.
    i did not test it with hardware but the SLAVE will work on the first TWi (twi0).
    This means the master need to use TWI1. (unless you modify the lib to of the add on)

    [code:1:a920eb11dc]'--------------------------------------------------------------------------------
    'name : m328pb.bas
    'copyright : (c) 1995-2023, MCS Electronics
    'purpose : demonstrates M328pb
    'micro : Mega328pb
    'suited for demo : yes
    'commercial addon needed : no
    '--------------------------------------------------------------------------------
    $regfile = "m328pbdef.dat"
    $crystal = 8000000
    $baud = 19200
    $hwstack = 40
    $swstack = 40
    $framesize = 40

    ' USART TX RX
    ' 0 D.1 D.0
    ' 1 B.3 B.4

    ' ISP programming
    ' MOSI-PB3 MISO-PB4 SCK-PB5

    ' TWI SDA SCL
    ' 0 C.4 C.5
    ' 1 E.0 E.1

    'Configuration

    Config Clockdiv = 1 'make sure we get 8 Mhz from internal osc

    Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
    Config Com2 = 19200 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0

    'we have 2 TWI interfaces
    Config Scl = Portc.5 ' we need to provide the SCL pin name
    Config Sda = Portc.4 ' we need to provide the SDA pin name

    Config Sda1 = Porte.0 'use this for the second TWI
    Config Scl1 = Porte.1

    Config Twi = 100000 'speed 100 KHz
    Config Twi1 = 100000 'speed 100 KHz


    Config Twislave = &H70 , Btr = 2 , Bitrate = 100000


    dim w as word

    'in this demo we only use the second SPI interface
    Config Spi1 = Hard , Interrupt = Off , Data_order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 128

    'some constants for the signature row
    Const Device_signature_byte1 = 0
    Const Device_signature_byte2 = 2
    Const Device_signature_byte3 = 4

    Const Rc_oscillator_calibration = 1

    Const Serial_number_byte0 = &H0E
    Const Serial_number_byte1 = &H0F
    Const Serial_number_byte2 = &H10
    Const Serial_number_byte3 = &H11
    Const Serial_number_byte4 = &H12
    Const Serial_number_byte5 = &H13
    Const Serial_number_byte6 = &H14
    Const Serial_number_byte7 = &H15
    Const Serial_number_byte8 = &H16
    Const Serial_number_byte9 = &H17

    $lib "I2C_TWI-MULTI.lib" 'important for using 2 TWI interfaces

    Dim _i2cchannel As Byte ' you MUST dim this variable yourself when using the above lib
    Dim B As Byte 'just a used byte
    Dim A(10) As Byte

    I2cinit 'default TWI init
    I2cinit Twi1 'optional specify TWI1 to init that interface

    Open "com2:" For Binary As #2 'create a channel to reference the UART

    'print the chip ID
    Print "ID : " ; Hex(readsig(device_signature_byte1)) ; Hex(readsig(device_signature_byte2)) ; Hex(readsig(device_signature_byte3))

    'all I2C statements will work the same. All you need to do is to set the _i2cchannel variable to 0 or 1
    _i2cchannel = 1 'try the second bus

    Print "Scan start"
    For B = 0 To 254 Step 2 'for all odd addresses
    I2cstart
    I2cwbyte B 'send address
    If Err = 0 Then 'we got an ack
    Print "Slave at : " ; B ; " hex : " ; Hex(b) ; " bin : " ; Bin(b)
    End If
    I2cstop 'free bus
    Next

    'second SPI
    Spi1init
    B = 5
    Spi1out A(1) , B
    Spi1in A(1) , B
    A(1) = Spi1move(a(2))

    Do
    Print "COM1"
    Print #2 , "COM2"
    Waitms 1000
    Loop

    'The following labels are called from the library. You need to insert code in these subroutines
    'Notice that the PRINT commands are remarked.
    'You can unmark them and see what happens, but it will result in occasional errors in the transmission
    'The idea is that you write your code in the called labels. And this code must execute in as little time
    'as possible. So when you slave must read the A/D converter, you can best do it in the main program
    'then the data is available when the master needs it, and you do not need to do the conversion which cost time.

    'A master can send or receive bytes.
    'A master protocol can also send some bytes, then receive some bytes
    'The master and slave must match.
    'the following labels are called from the library when master send stop or start
    Twi_stop_rstart_received:
    ' Print "Master sent stop or repeated start"
    Return
    'master sent our slave address and will not send data
    Twi_addressed_goread:
    ' Print "We were addressed and master will send data"
    Return

    Twi_addressed_gowrite:
    ' Print "We were addressed and master will read data"
    Return
    'this label is called when the master sends data and the slave has received the byte
    'the variable TWI holds the received value
    Twi_gotdata:
    'Print "received : " ; Twi ; " byte no : " ; Twi_btw
    Select Case Twi_btw
    Case 1 : Portb = Twi ' first byte
    Case 2: 'you can set another port here for example
    End Select ' the setting of portb has nothing to do with the ADC
    Return
    'this label is called when the master receives data and needs a byte
    'the variable twi_btr is a byte variable that holds the index of the needed byte
    'so when sending multiple bytes from an array, twi_btr can be used for the index
    Twi_master_needs_byte:
    'Print "Master needs byte : " ; Twi_btr
    Select Case Twi_btr
    Case 1: ' first byte
    W = Getadc(0) 'in this example the conversion is done here
    ' but a better option would have been to just pass the value of W and do the conversion in the main loop
    'Print "ADC-SLAVE:" ; W
    Twi = Low(w)
    Case 2 ' send second byte
    Twi = High(w)
    End Select
    Return

    'when the mast has all bytes received this label will be called
    Twi_master_need_nomore_byte:
    ' Print "Master does not need anymore bytes"
    Return
    [/code:1:a920eb11dc]

    the samples uses adc but it is not configured as i just copy some twi slave code.
    but the important thing : twi0 will be used as slave and twi1 as master.

  • BASCOM-AVR : UPDI : REPLY



    interesting.

    but is it faster than programming with a CP2102?

    jp :wink:

  • BASCOM-AVR : Atmega328pb TWI slave and master : REPLY



    [quote="andrge"][quote:a56abd342a="programmista123"]yes, I have the add-on library[/quote:a56abd342a]
    No samples included there?

  • BASCOM-AVR : Atmega328pb TWI slave and master : REPLY



    [quote:d7f5bf2ba6="programmista123"]Hello,

    Do you have I2C-Slave library?
    "I2C TWI Slave is part of the I2C-Slave library. This is an add-on library that is not included in Bascom-AVR by default."
    [url=https://avrhelp.mcselec.com/config_twislave.htm?zoom_highlightsub=twi%2Bslave]TWI Slave - HELP

    Regards,
    Przemek[/quote:d7f5bf2ba6]

    Hi Przemek,

    yes, I have the add-on library

    BR
    Andreas

  • BASCOM-AVR : Atmega328pb TWI slave and master : REPLY



    [quote:7ee783da33="andrge"]I did not find anything about 328pb with master and slave in the demo from bascom.[/quote:7ee783da33]
    Because Bascom without add-on supports TWI-Master only.

    Add-on programmista mentioned:
    https://www.mcselec.com/index.php?page=shop.product_details&flypage=shop.flypage&product_id=34&category_id=6&option=com_phpshop&Itemid=1

  • BASCOM-AVR : Atmega328pb TWI slave and master : REPLY



    Hello,

    Do you have I2C-Slave library?
    "I2C TWI Slave is part of the I2C-Slave library. This is an add-on library that is not included in Bascom-AVR by default."
    [url=https://avrhelp.mcselec.com/config_twislave.htm?zoom_highlightsub=twi%2Bslave]TWI Slave - HELP

    Regards,
    Przemek

  • BASCOM-AVR : Atmega328pb TWI slave and master : NEWTOPIC



    Hi forum,

    i have a question about the twi and atmega328pb.
    for my project i would like to use the twi0 as slave and the twi1 as master. How can I configure the twi slave?

    I did not find anything about 328pb with master and slave in the demo from bascom. Can someone give me a tip or an example?

    I found an example for the 328pb in my MCS folder under smaples/chips. However, no slave is used here.
    It is the dame demo as on the help side, here https://avrhelp.mcselec.com/index.html?i2c_twi_multi.htm


    regards
    Andreas

    [b:8aa0c4508d][color=red:8aa0c4508d](BASCOM-AVR version : 2.0.8.6 , Latest : 2.0.8.6 )[/b:8aa0c4508d][/color:8aa0c4508d]

| Date published: not known
Back to newsfeed list
Welcome
Username or Email:

Password:




[ ]
[ ]
Headlines

»BASCOM-AVR : UPDI : REPLY
Above Mark asked about the SNAP V1 and V2 VIDs. I have both SNAP versions. The new SNAP V2 has a small 3-Pin header on the SNA...
»BASCOM-AVR : UPDI : REPLY
[quote:14703ece8d="programmista123"]Hi, Could you share programmer options screenshot? Do you have any errors?[/quote:14703ece...
»BASCOM-AVR : UPDI : REPLY
It is nomather if it is faster. When you lock AVR with UPDI you need a 12V pulse to unlock it. I think even SNAP cant do that....
»BASCOM-AVR : Atmega328pb TWI slave and master : REPLY
you need to merge the samples. i did not test it with hardware but the SLAVE will work on the first TWi (twi0). This means the ...
»BASCOM-AVR : UPDI : REPLY
interesting. but is it faster than programming with a CP2102? jp :wink:
»BASCOM-AVR : Atmega328pb TWI slave and master : REPLY
[quote="andrge"][quote:a56abd342a="programmista123"]yes, I have the add-on library[/quote:a56abd342a] No samples included there?...
»BASCOM-AVR : Atmega328pb TWI slave and master : REPLY
[quote:d7f5bf2ba6="programmista123"]Hello, Do you have I2C-Slave library? "I2C TWI Slave is part of the I2C-Slave library. Thi...
»BASCOM-AVR : Atmega328pb TWI slave and master : REPLY
[quote:7ee783da33="andrge"]I did not find anything about 328pb with master and slave in the demo from bascom.[/quote:7ee783da33] ...
»BASCOM-AVR : Atmega328pb TWI slave and master : REPLY
Hello, Do you have I2C-Slave library? "I2C TWI Slave is part of the I2C-Slave library. This is an add-on library that is not i...
»BASCOM-AVR : Atmega328pb TWI slave and master : NEWTOPIC
Hi forum, i have a question about the twi and atmega328pb. for my project i would like to use the twi0 as slave and the twi1 ...


Date published: not known
Details

»24 Volt wie verteilen?
Hallo, ich möchte gerne vom Keller bis zum Dachboden 24V durchleiten. Als Kabel liegt schon 15m sowas wie NYM Kabel und 20 m BK KOAX Kabel. Die St...
»Quellcode aus Hex oder Bin erzeugen
Hallo Ich habe ein Programm für den Atmega 8515 das mir im Hex Format vorliegt. Kann man daraus wieder Quellcode erzeugen. Das ganze diente als Ste...
»Servo über Timer2
Ein frohes Neues, einen Servo mit einem 8bit Timer zu steuern ergibt recht wenig Stufen, wenn die 20ms Wiederholrate (annähernd) eingehalten wird. ...
»Guten Rutsch und ein gutes neues Jahr Jungs
Hi, bin nicht wirklich aktiv hier und selten bis gar nicht wirklich eine Hilfe. Ändert nichts daran dass genau dieses Forum mir sehr viel bedeutet....
»UPDI-Programmierung
Abendgruß aus MD, will mir die neuen ATTiny412 u. 414 zulegen und diese mit UPDI programmieren. In BASCOM werden diese ja unter ATxtiny412 aufgefü...
»CMOS-Dezimal-Counter- bzw. -Teiler-Kaskade in Bascom umsetzen
Hallo in die Runde, ich bin ganz neu hier und hoffe auf Hilfe und Tipps durch die Forummitglieder. Kurz zu mir: Ich bin schon etwas älter, bastel ...


Date published: Fri, 10 Jan 2025 14:42:02 +0000
Details

»4 January 20244 January 2024
»93c46 editor programmer bascom & vb93c46 editor programmer bascom & vb
»93c46 Bascom & VB693c46 Bascom & VB6
»Analog clock on SSD1289 3.2" 240x320 lcdAnalog clock on SSD1289 3.2" 240x320 lcd
»Nextion HMI lcd with KaraDio the best webradio esp8266Nextion HMI lcd with KaraDio the best webradio esp8266
»Adding 240x320 lcd to the WifiWebRadioAdding 240x320 lcd to the WifiWebRadio


Date published: not known
Details

»Bascom Can Bus Sniffer
»R.I.P Ben Zijlstra
Remembering Ben Zijlstra We hope that people who love Ben will remember and celebrate his life. more info at MCS www.mcselec.com/index2.ph...
»KaRadio webradio ESP8266
The Dimitris board is available at https://github.com/dsaltas/WiFi-WebRadio  This is a hardware project for Ka-Radio
»93C46
small tool to edit 93C46 eeprom written in BascomAVR & VB  Bascom control the 93C46 so we sent data via comport from VB code will be added later ...
»nRF24L01+ RC Controller
This is a RC controller TX & RX unit with nRF24L01+ nRF24L01+ / with PA and LNA for longer range facts: TX 1 x potmeter for servo ...
»RAW lcd
Connecting RAW lcd to atmega8 the lcd is 6 digit + time glass LCD Hour Meter for  tractor ,air compressor, ect the lcd have 4 com pins  & 14...


Date published: not known
Details


Proudly powered by e107 which is released under the terms of the GNU GPL License.