Author Topic: One crazy SAMD21G MCU – I2C/RESET issues (custom PCB design)  (Read 3221 times)

0 Members and 1 Guest are viewing this topic.

Offline 3dgeoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: au
Re: One crazy SAMD21G MCU – I2C/RESET issues (custom PCB design)
« Reply #25 on: October 05, 2019, 10:36:34 pm »
Hm, I still don't understand how to upload to SAMD21 via USB when bootloader is already programmed, any tips on that?
 

Offline 3dgeoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: au
Re: One crazy SAMD21G MCU – I2C/RESET issues (custom PCB design)
« Reply #26 on: October 05, 2019, 11:13:46 pm »
This is Arduino USB Composite example:

Code: [Select]
#include "Keyboard.h"

void setup()
{
  Serial.begin(9600);
  Keyboard.begin();
}

void loop()
{
  if (Serial.available() > 0)
  {
    char inChar = Serial.read();
    Keyboard.write(inChar + 1);
  }

}


and this is Atmels example:

Code: [Select]
#include "atmel_start.h"
 #include "atmel_start_pins.h"

 #define CDC_EN (CONF_USB_COMPOSITE_CDC_ECHO_DEMO && CONF_USB_COMPOSITE_CDC_ACM_EN)
#define MOUSE_EN (CONF_USB_COMPOSITE_HID_MOUSE_DEMO && CONF_USB_COMPOSITE_HID_MOUSE_EN)
 #define KEYBOARD_EN (CONF_USB_COMPOSITE_HID_KEYBOARD_DEMO && CONF_USB_COMPOSITE_HID_KEYBOARD_EN)
 #define MSC_EN (CONF_USB_COMPOSITE_MSC_LUN_DEMO && CONF_USB_COMPOSITE_MSC_EN)

 #if CDC_EN
static uint32_t cdc_demo_buf[64 / 4];
 #endif
 #if MSC_EN
 #if CONF_USB_MSC_LUN0_ENABLE
static uint32_t msc_ramdisk_buf[CONF_USB_MSC_LUN0_CAPACITY * 1024 / 4];

 #define msc_ramdisk_buf NULL
 #endif
 #if CONF_USB_MSC_LUN1_ENABLE
static uint32_t msc_diskcache_buf[CONF_USB_MSC_LUN_BUF_SECTORS * 512 / 4];

 #define msc_diskcache_buf NULL
 #endif
 #endif

int main(void)
{
atmel_start_init();

/* Do function or app specific initialize */
 #if CDC_EN
cdcdf_acm_demo_init((uint8_t *)cdc_demo_buf);
 #endif
 #if KEYBOARD_EN || MOUSE_EN
hiddf_demo_init(BUTTON1, BUTTON2, BUTTON3);
 #endif
 #if MSC_EN
mscdf_demo_init((uint8_t *)msc_ramdisk_buf, (uint8_t *)msc_diskcache_buf);
 #endif

/* Start the composite device */
composite_device_start();

/* Main loop */
while (1) {
 #if MSC_EN
mscdf_demo_task();
 #endif
}
}


What I'm suppose to do with this crap? Where is " Keyboard.write(); " and " Serial.println(); " equivalents?  :rant:  :wtf:

Anyway, back to the topic, I need to solve Reset and board issues...
« Last Edit: October 06, 2019, 01:38:09 am by 3dgeo »
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • Country: us
    • Personal site
Re: One crazy SAMD21G MCU – I2C/RESET issues (custom PCB design)
« Reply #27 on: October 05, 2019, 11:48:45 pm »
Hm, I still don't understand how to upload to SAMD21 via USB when bootloader is already programmed, any tips on that?
That depends on the type of bootloader. Mine comes with a command like tool.
Alex
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • Country: us
    • Personal site
Re: One crazy SAMD21G MCU – I2C/RESET issues (custom PCB design)
« Reply #28 on: October 05, 2019, 11:50:53 pm »
WTF I'm suppose to do with this crap? Where is " Keyboard.write(); " and " Serial.println(); " equivalents?  :rant:  :wtf:

Welcome to the grown up programming world. Where you actually have to do programming. If you want think to be easy, stick with Arduino. But when it becomes too limited, you will have  to make a switch.

Also, don't make a mistake thinking that manufacturer supplied code is good. It is not. But it works, and that's how much you can ask of it, really.
Alex
 

Offline 3dgeoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: au
Re: One crazy SAMD21G MCU – I2C/RESET issues (custom PCB design)
« Reply #29 on: October 06, 2019, 01:37:18 am »
Welcome to the grown up programming world. Where you actually have to do programming.

Well, you are advanced programmer so you should know that it is nothing to do with "doing actual programming" – this example is simply not optimized for use of itself as a library.

Cos of minimum configuration issues I'm having with SAMD21 + I have to add extra chip for driving 5V Pfet I'm considering going back to STM32f103.
It's over 2 times cheaper + no extra chip due to 5V tolerant IO, it's also 1/3 faster (I need speed). As most likely I will have to role up my own bootloader/USB composite lib anyway I think this is a logical decision (I picked SAMD21 cos I hoped to avoid "real programming"  ;D ).
Bummer, what a waste, I was quite invested in SAMD21 (money and time wise). Oh well, I might get back to SAMD  ::)

 

Offline 3dgeoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: au
Re: One crazy SAMD21G MCU – I2C/RESET issues (custom PCB design)
« Reply #30 on: October 06, 2019, 06:37:11 pm »
After connecting VDDANA to 3.3V now instead of no devices I'm getting this:

Code: [Select]
Scanning...
I2C device found at address 0x01  !
I2C device found at address 0x02  !
I2C device found at address 0x03  !
I2C device found at address 0x04  !
I2C device found at address 0x05  !
I2C device found at address 0x06  !
I2C device found at address 0x07  !
I2C device found at address 0x08  !
I2C device found at address 0x09  !
I2C device found at address 0x0A  !
I2C device found at address 0x0B  !
I2C device found at address 0x0C  !
I2C device found at address 0x0D  !
I2C device found at address 0x0E  !
I2C device found at address 0x0F  !
I2C device found at address 0x10  !
I2C device found at address 0x11  !
I2C device found at address 0x12  !
I2C device found at address 0x13  !
I2C device found at address 0x14  !
I2C device found at address 0x15  !
I2C device found at address 0x16  !
I2C device found at address 0x17  !
I2C device found at address 0x18  !
I2C device found at address 0x19  !
I2C device found at address 0x1A  !
I2C device found at address 0x1B  !
I2C device found at address 0x1C  !
I2C device found at address 0x1D  !
I2C device found at address 0x1E  !
I2C device found at address 0x1F  !
I2C device found at address 0x20  !
I2C device found at address 0x21  !
I2C device found at address 0x22  !
I2C device found at address 0x23  !
I2C device found at address 0x24  !
I2C device found at address 0x25  !
I2C device found at address 0x26  !
I2C device found at address 0x27  !
I2C device found at address 0x28  !
I2C device found at address 0x29  !
I2C device found at address 0x2A  !
I2C device found at address 0x2B  !
I2C device found at address 0x2C  !
I2C device found at address 0x2D  !
I2C device found at address 0x2E  !
I2C device found at address 0x2F  !
I2C device found at address 0x30  !
I2C device found at address 0x31  !
I2C device found at address 0x32  !
I2C device found at address 0x33  !
I2C device found at address 0x34  !
I2C device found at address 0x35  !
I2C device found at address 0x36  !
I2C device found at address 0x37  !
I2C device found at address 0x38  !
I2C device found at address 0x39  !
I2C device found at address 0x3A  !
I2C device found at address 0x3B  !
I2C device found at address 0x3C  !
I2C device found at address 0x3D  !
I2C device found at address 0x3E  !
I2C device found at address 0x3F  !
I2C device found at address 0x40  !
I2C device found at address 0x41  !
I2C device found at address 0x42  !
I2C device found at address 0x43  !
I2C device found at address 0x44  !
I2C device found at address 0x45  !
I2C device found at address 0x46  !
I2C device found at address 0x47  !
I2C device found at address 0x48  !
I2C device found at address 0x49  !
I2C device found at address 0x4A  !
I2C device found at address 0x4B  !
I2C device found at address 0x4C  !
I2C device found at address 0x4D  !
I2C device found at address 0x4E  !
I2C device found at address 0x4F  !
I2C device found at address 0x50  !
I2C device found at address 0x51  !
I2C device found at address 0x52  !
I2C device found at address 0x53  !
I2C device found at address 0x54  !
I2C device found at address 0x55  !
I2C device found at address 0x56  !
I2C device found at address 0x57  !
I2C device found at address 0x58  !
I2C device found at address 0x59  !
I2C device found at address 0x5A  !
I2C device found at address 0x5B  !
I2C device found at address 0x5C  !
I2C device found at address 0x5D  !
I2C device found at address 0x5E  !
I2C device found at address 0x5F  !
I2C device found at address 0x60  !
I2C device found at address 0x61  !
I2C device found at address 0x62  !
I2C device found at address 0x63  !
I2C device found at address 0x64  !
I2C device found at address 0x65  !
I2C device found at address 0x66  !
I2C device found at address 0x67  !
I2C device found at address 0x68  !
I2C device found at address 0x69  !
I2C device found at address 0x6A  !
I2C device found at address 0x6B  !
I2C device found at address 0x6C  !
I2C device found at address 0x6D  !
I2C device found at address 0x6E  !
I2C device found at address 0x6F  !
I2C device found at address 0x70  !
I2C device found at address 0x71  !
I2C device found at address 0x72  !
I2C device found at address 0x73  !
I2C device found at address 0x74  !
I2C device found at address 0x75  !
I2C device found at address 0x76  !
I2C device found at address 0x77  !
I2C device found at address 0x78  !
I2C device found at address 0x79  !
I2C device found at address 0x7A  !
I2C device found at address 0x7B  !
I2C device found at address 0x7C  !
I2C device found at address 0x7D  !
I2C device found at address 0x7E  !
done


Troll board... :-DD
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf