• AVR Freaks

Hot!AtMega4808 (chip of AVR IoT WG) - Generating wave form

Author
PsySc0rpi0n
New Member
  • Total Posts : 24
  • Reward points : 0
  • Joined: 2018/12/20 15:24:20
  • Location: Portugal
  • Status: offline
2019/02/23 11:50:40 (permalink)
0

AtMega4808 (chip of AVR IoT WG) - Generating wave form

Hello...
 
Ok, this looks to be working now!
 
So, I'm trying to create a waveform with the AtMega4808 that comes with AVR IoT WG and I still coudn't make it work.
I'm new to this chip and I have some trouble understanding somethings from datasheet and user manual.
 
I have the following code:
/* 
 * File: LedBlink.c
 * Author: PsySc0rpi0n
 *
 * Created on 20 de Fevereiro de 2019, 21:35
 */
#define F_CPU 20000000UL

#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <avr/io.h>
#include <util/delay.h>

/*
 *
 */

int main(int argc, char** argv) {
    //http://ww1.microchip.com/downloads/en/DeviceDoc/40002015A.pdf
    
    // Main Clock Configuration
    // page 84
    CLKCTRL_MCLKCTRLA &= ~CLKCTRL_CLKSEL_OSC20M_gc; // Select 20MHz Internal Oscillator
    // page 85
    CLKCTRL_MCLKCTRLB &= ~CLKCTRL_PEN_bp; // Disable Prescaler
    
    
    // page
    TCA0_SINGLE_CMP0 = 0x07cf; // TOP --> 5000Hz = (20e6/6)/(2*1(CMPn + 1)) <=> CMPn = 1999
    
    //http://ww1.microchip.com/downloads/en/DeviceDoc/40002015A.pdf, page 190, 208,
    TCA0_SINGLE_CTRLB |= (1 << 0); // Wave Generation Mode --> FRQ
    TCA0_SINGLE_EVCTRL &= ~( (1 << 2) | (1 << 1) | (1 << 0)); // Incremental Ticks counting mode (Positive edge) - No events counting
    TCA0_SINGLE_CTRLB |= TCA_SINGLE_CMP0EN_bp; // Compare channels enabled
    PORTMUX_TCAROUTEA &= ~PORTMUX_TCA0_gm; // Set PA[0:5] as output for the wave form
    PORTA_OUT |= (1 << PIN0_bp); // Set PIN0 of PORTA as output to see waveform
    for ( ; ;){

    }
    return (EXIT_SUCCESS);
}

 
But I still can't see the wave form in PA0 with my scope.
 
I'm using MPLAB X IDE v5.10 in Debian 9.6 and using AVR ToolChain 5.4.0 in MPLAB X IDE.
I see this compilation output and there are 2 lines that might raise some attention and I don't know if they are a problem.
 
Configuration Bits: address 0x821282: FREQSEL = 0 does not match any valid value in the device database.
Configuration Bits: address 0x83128A: LB = 0 does not match any valid value in the device database.
 
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory '/media/wdelements/Microchip/MPLAB-X/Projects/LedBlink.X'
make -f nbproject/Makefile-default.mk dist/default/production/LedBlink.X.production.hex
make[2]: Entering directory '/media/wdelements/Microchip/MPLAB-X/Projects/LedBlink.X'
"/home/narayan/avr8-gnu-toolchain-linux_x86_64/bin/avr-gcc" -mmcu=atmega4808 -I "/opt/microchip/mplabx/v5.10/packs/Atmel/ATmega_DFP/1.2.285/include" -B "/opt/microchip/mplabx/v5.10/packs/Atmel/ATmega_DFP/1.2.285/gcc/dev/atmega4808" -x c -c -D__ATmega4808__ -funsigned-char -funsigned-bitfields -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -MD -MP -MF "build/default/production/LedBlink.o.d" -MT "build/default/production/LedBlink.o.d" -MT build/default/production/LedBlink.o -o build/default/production/LedBlink.o LedBlink.c -DXPRJ_default=default
"/home/narayan/avr8-gnu-toolchain-linux_x86_64/bin/avr-gcc" -mmcu=atmega4808 -B "/opt/microchip/mplabx/v5.10/packs/Atmel/ATmega_DFP/1.2.285/gcc/dev/atmega4808" -D__ATmega4808__ -Wl,-Map="dist/default/production/LedBlink.X.production.map" -o dist/default/production/LedBlink.X.production.elf build/default/production/LedBlink.o -DXPRJ_default=default -Wl,--defsym=__MPLAB_BUILD=1 -Wl,--gc-sections -Wl,--start-group -Wl,-lm -Wl,--end-group
"/home/narayan/avr8-gnu-toolchain-linux_x86_64/bin"/avr-objcopy -O ihex "dist/default/production/LedBlink.X.production.elf" "dist/default/production/LedBlink.X.production.hex"
make[2]: Leaving directory '/media/wdelements/Microchip/MPLAB-X/Projects/LedBlink.X'
make[1]: Leaving directory '/media/wdelements/Microchip/MPLAB-X/Projects/LedBlink.X'

BUILD SUCCESSFUL (total time: 104ms)
Loading code from /media/wdelements/Microchip/MPLAB-X/Projects/LedBlink.X/dist/default/production/LedBlink.X.production.hex...
Configuration Bits: address 0x821282: FREQSEL = 0 does not match any valid value in the device database.
Setting to the default value.
Configuration Bits: address 0x83128A: LB = 0 does not match any valid value in the device database.
Setting to the default value.
Loading completed

post edited by PsySc0rpi0n - 2019/02/23 11:55:35
#1

7 Replies Related Threads

    DeutcheN
    Senior Member
    • Total Posts : 105
    • Reward points : 0
    • Joined: 2010/09/01 12:35:40
    • Location: DM43BH
    • Status: offline
    Re: AtMega4808 (chip of AVR IoT WG) - Generating wave form 2019/02/26 11:03:24 (permalink)
    #2
    PsySc0rpi0n
    New Member
    • Total Posts : 24
    • Reward points : 0
    • Joined: 2018/12/20 15:24:20
    • Location: Portugal
    • Status: offline
    Re: AtMega4808 (chip of AVR IoT WG) - Generating wave form 2019/02/27 13:05:58 (permalink)
    0
    Aleman
     
    Duplicate question from:
     
    https://www.avrfreaks.net/forum/atmega4808-wave-form-generator?skey=AVR%20IOT
     
     




    Duplicate?? Lol... You know what duplicate means? It means the same post twice in the same place!
    Do you think AVR Freaks and Microchip forums is the same place? I don't think so!
     
    You need to review your reasoning about "duplicate" meaning!
    And your reply didn't help in any possible way that I can think of.
    #3
    rodims
    Super Member
    • Total Posts : 1478
    • Reward points : 0
    • Joined: 2009/02/10 11:08:59
    • Location: 51.9627, 7.6262
    • Status: offline
    Re: AtMega4808 (chip of AVR IoT WG) - Generating wave form 2019/02/27 14:12:14 (permalink)
    0
    If you did not realize,- you have posted your duplicate in the PIC forum:  PIC Microcontrollers (PIC10F, PIC12F, PIC16F, PIC18F)
    which obviously does not fit your ATMega question very well.
    You already got a lot of response in the AVR Freaks forum, which indeed is the better choice.
    #4
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: AtMega4808 (chip of AVR IoT WG) - Generating wave form 2019/02/27 14:58:42 (permalink)
    +1 (1)
    PsySc0rpi0n
    Duplicate?? Lol... You know what duplicate means? It means the same post twice in the same place!

    According to who?
    That's just your definition. Many people frequent both forums, and it's useful (for potential answerers) to know what has already been discussed.
     

    Nearly there...
    #5
    PsySc0rpi0n
    New Member
    • Total Posts : 24
    • Reward points : 0
    • Joined: 2018/12/20 15:24:20
    • Location: Portugal
    • Status: offline
    Re: AtMega4808 (chip of AVR IoT WG) - Generating wave form 2019/02/27 16:18:26 (permalink)
    0
    rodims
    If you did not realize,- you have posted your duplicate in the PIC forum:  PIC Microcontrollers (PIC10F, PIC12F, PIC16F, PIC18F)
    which obviously does not fit your ATMega question very well.
    You already got a lot of response in the AVR Freaks forum, which indeed is the better choice.


     
    Yes, because I think there is no specific forum for Megas.. So I started it in the 8-bit forums.
    And DeutcheN said it was a duplicate from another forum. But I think there is nothing wrong in asking it in more than one place! And since I'm using MPLAB X IDE, this forum was also suitable for my questions.
     
    qhb
    PsySc0rpi0n
    Duplicate?? Lol... You know what duplicate means? It means the same post twice in the same place!

    According to who?
    That's just your definition. Many people frequent both forums, and it's useful (for potential answerers) to know what has already been discussed.



     
    According to most internet standards.
    Just as a side note, if you ask in the bit torrent world (and other places like "the scene") what is a DUPE (short for duplicate), I think you know what the answer will be. But I'll make it clear by myself. It's a duplicate post in the same torrent site. You can, and many people does it, post the same torrent in different torrent site.
     
    And last but not the least, I have created this thread like 3 of 4 days ago and no one bothered in trying to help me but as soon as someone criticised my thread just because there was another thread just like this one in another forum, I got 3 replies in a matter of hours!... Yeah... I'm sad for this!
     
    I also have posted another thread in another subforum here in Microchip forum about an error message I get every time I start MPLAB and no one also bothered in helping me! Yeah, makes me sad that for criticising uselessly others, everybody is ready and "pronto" but for helping, this is what is "on sight"!!!  
    post edited by PsySc0rpi0n - 2019/02/27 16:22:16
    #6
    rodims
    Super Member
    • Total Posts : 1478
    • Reward points : 0
    • Joined: 2009/02/10 11:08:59
    • Location: 51.9627, 7.6262
    • Status: offline
    Re: AtMega4808 (chip of AVR IoT WG) - Generating wave form 2019/02/28 05:17:13 (permalink)
    0
    I also have posted another thread in another subforum here in Microchip forum about an error message I get every time I start MPLAB and no one also bothered in helping me! Yeah, makes me sad that for criticising uselessly others, everybody is ready and "pronto" but for helping, this is what is "on sight"!!!

     
    The hint for you was:  you will not get much (may be not any) help in the Microchip PIC forum for explicit Atmel MPU questions. 
    Duplicating questions to receive more answers may appear good for you, but reduces the willingness of forum members to spend their free time with questions, which have already been answered. 
    #7
    PsySc0rpi0n
    New Member
    • Total Posts : 24
    • Reward points : 0
    • Joined: 2018/12/20 15:24:20
    • Location: Portugal
    • Status: offline
    Re: AtMega4808 (chip of AVR IoT WG) - Generating wave form 2019/02/28 13:25:06 (permalink)
    0
    rodims
    I also have posted another thread in another subforum here in Microchip forum about an error message I get every time I start MPLAB and no one also bothered in helping me! Yeah, makes me sad that for criticising uselessly others, everybody is ready and "pronto" but for helping, this is what is "on sight"!!!

     
    The hint for you was:  you will not get much (may be not any) help in the Microchip PIC forum for explicit Atmel MPU questions. 
    Duplicating questions to receive more answers may appear good for you, but reduces the willingness of forum members to spend their free time with questions, which have already been answered. 




    So maybe moderators should have moved the thread to the correct places.
    And my goal, when I posted my questions here and in AVR Freaks was not to get more answers. It was to try to get the best of two worlds. Here, because I'm using MPLAB, and there because it is an AVR chip anyways!
    #8
    Jump to:
    © 2019 APG vNext Commercial Version 4.5