You need to log in to create posts and topics.

Modify Arduino Nano to use mega328PB

How can I modify the Arduino Nano to use the atmega328PB chip - as it is used on some cheap clones to enable simulation of the additional features - like the additional HW-Timers 3 & 4 .... 
Or is it easier to build a new Block my own and use a mega328PB ? 

Hi.

You can modify or create a new one if copy and rename the files at simulide/data/arduino/Nano

Open the subcircuit in Simulide: simulide/data/arduino/Nano/Nano.sim1
There you edit the circuit:
- Change the chip.
- Right-click in the package and click in "Select Exposed Components", then click in the atmega328PB chip (it will get yellow).
- Save the circuit.

If you create a new one you should add it to simulide/data/arduinos.xml

 

Thank you for that advice.
It did work for Timer 3 & 4 - which are new in the PB.
But I have a problem with the ADC.
I use the ADC with a ISR for ADC Ready.
In that ISR I loop through all 8 analog Inputs - this works and with a breakpoint in the ADC ISR I can see the ADMUX and ADCSRA are correctly set - but what-ever I connect to the analog Inputs - no results in the ADCL & ADCH register - always 0
Here the code for the ADC ISR - the ISR is started with the same settings in the setup() function and A0 to A7 are defined as INPUT

/*
Interrupt Service Routine to handle ADC-Ready interrupt
stores 16 samples sequential for all analog input channels
*/
ISR(ADC_vect){
   digitalWrite(10, HIGH);
   ADC_Values[index>>3 & 0x0F][index & 0x07] = ADCL + (ADCH << 8);
   index++;
   index &= 0x7F;
   ADMUX = 0x40 + (index & 0x07);
   ADCSRA = 0xC0 + 0x08 + ADC_CLK; // Enable and Start ADC with Interrupt Enabled and ADC-Prescaler = 7
   digitalWrite(10, LOW);
    if(index == 0) ADC_Flag = 1;
}

This works perfect on real HW - but not in this simulator

Hi.

Have you tried with a bare Atmega328PB?

Thanks for the fast reply - I found it in the meanwhile - I had no C on AREF - now it seem to work

It does not work correctly - all samples are full scale - all 10 bits set, whatever is connected at A0 to A7 
Also tested on bare 328PB

ADC for Atmega328PB is working for me.
Can you share your circuit and firmware to have a look?

I've setup my configuration again from scratch - now it is working perfectly.
Congratulation and thanks for that great tool.

Any intention to add more cores like ARM (RPi Pico & Pico2), RISC-V and ESP?

 

Glad to know you got it working.

 

Any intention to add more cores like ARM (RPi Pico & Pico2), RISC-V and ESP?

I would love to do that, but by now we don't have the resources to do it.
Implementing each one of those devices can take hundreds if not thousands of hours of work.

There is some work in progress to support 32 bit CPUs, but just this will take some time.