Electronics > Projects, Designs, and Technical Stuff
One crazy SAMD21G MCU – I2C/RESET issues (custom PCB design)
3dgeo:
Hm, I still don't understand how to upload to SAMD21 via USB when bootloader is already programmed, any tips on that?
3dgeo:
This is Arduino USB Composite example:
--- Code: --- #include "Keyboard.h"
void setup()
{
Serial.begin(9600);
Keyboard.begin();
}
void loop()
{
if (Serial.available() > 0)
{
char inChar = Serial.read();
Keyboard.write(inChar + 1);
}
}
--- End code ---
and this is Atmels example:
--- Code: --- #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
}
}
--- End code ---
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...
ataradov:
--- Quote from: 3dgeo 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?
--- End quote ---
That depends on the type of bootloader. Mine comes with a command like tool.
ataradov:
--- Quote from: 3dgeo on October 05, 2019, 11:13:46 pm ---WTF I'm suppose to do with this crap? Where is " Keyboard.write(); " and " Serial.println(); " equivalents? :rant: :wtf:
--- End quote ---
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.
3dgeo:
--- Quote from: ataradov on October 05, 2019, 11:50:53 pm ---Welcome to the grown up programming world. Where you actually have to do programming.
--- End quote ---
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 ::)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version