Hello!, this is my first post!, so I hope I wasn’t wrong in choosing the right category.
I state that I am a bit inexperienced with PlatformIO and this is one of my first projects with this software.
Come to the point.
I have problems with the developement of a temperature controller based on Attiny85 MCU, precisely I am unable to get a serial communication via the MCU itself and the PC via a separate UART-> USB converter.
I specify that due to the need of the code I have changed the prescaler of Timer1 to generate a 30kHz PWM on digital pin 1 (D1).
But I don’t think it is very important because from what I have seen even removing the prescaler settings I always get the same problems.
My setup consists of
- Arduino UNO (as ISP)
- Self Made shield for ATtiny85 programming
- VSCode + PlatformIO extension
- ATtiny85 with Arduino bootloader
From what I understand the SoftwareSerial can only be established if the frequency of the cpu is set to 8MHz, but since with the prescaler of 1 I can only get 18kHz on D1 it makes me think that the ATtiny85 is not running at 8MHz and all this would explain why in the serial monitor I get only random characters.
I tried to load the code with the Arduino IDE but I get the same result.
However I attach the platformio.ini file and the string I use for the prescaler.
(to set the platfromio.ini config file I followed the official PlatformIO wiki)
[env:attiny85] platform = atmelavr board = attiny85 board_hardware.oscillator = internal board_build.f_cpu = 8000000L ; MCU frequency framework = arduino upload_protocol = custom upload_port = COM4 upload_speed = 19200 upload_flags = -C $PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf -p $BOARD_MCU -P $UPLOAD_PORT -b $UPLOAD_SPEED -c stk500v1 upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
Timer/ Prescaler settings
TCCR1 = TCCR1 & 0b11110000 | 0b0001;
Thanks to everyone for the help given to me in advance