platformio / platform-atmelmegaavr

Atmel megaAVR: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelmegaavr
Apache License 2.0
29 stars 21 forks source link

problem with uart on attiny1624 #38

Open marco-117 opened 2 years ago

marco-117 commented 2 years ago

Hi,

i wanted to use the new implemented attiny1624, but i have issues with the two UARTs. I tried the code in PlatformIO and in the Arduino IDE. In the Arduino IDE the UARTs are sending and receiving. In PlatformIO at least on UART dont work, i didnt check wich UART dont work or if both dont work.

I hope somone can help.

JorgeTorres01 commented 2 years ago

hi marco-117

In the last few days, I tested the new Attiny series (attiny426). I'm checking if the PWM, I2C, SPI, ADC, DAC, UART... on PlatformIO works with "functions Arduino"

The PCB that I used does not use some pins, ex. PB2, PA3, ... so I didn't test the RxD (PB3), TxD (PB2) (Serial). Only the RxD, TxD with Serial1 and its work :

#include <Arduino.h>

FUSE_t fus;
LOCKBITS = LB_RWLOCK_gc;

void setup () {
    fus.WDTCFG    = FUSE_WDTCFG_DEFAULT;
    fus.BODCFG    = FUSE_BODCFG_DEFAULT;
    fus.OSCCFG    = FUSE_OSCCFG_DEFAULT;
    fus.SYSCFG0   = FUSE_SYSCFG0_DEFAULT;
    fus.SYSCFG1   = FUSE_SYSCFG0_DEFAULT;
    fus.APPEND    = FUSE_APPEND_DEFAULT;
    fus.BOOTEND = FUSE_BOOTEND_DEFAULT;

    Serial1.begin(115200);
}

void loop () {
    Serial1.println("test");
    delay(1000);
}

image

platformio.ini

[env]
platform = https://github.com/platformio/platform-atmelmegaavr.git
board = ATtiny426
framework = arduino

[env:Upload_using_pyupdi]
upload_protocol = custom
upload_speed = 115200
upload_port = COM21
upload_flags =
  -t
  uart
  -d
  $BOARD_MCU
  -u
  $UPLOAD_PORT
  -c
  $UPLOAD_SPEED
upload_command = pymcuprog write $UPLOAD_FLAGS -f $SOURCE -C