Arduino Pro Mini 3V 8Mhz Serial problems

I purchased a few Pro Minis because they were cheap and used 3v ttl rather than 5. I am trying to use it to control a DRA818 via serial. I am using software serial for the DRA818 and standard TX/RX for troubleshooting. I got the code working and the 818 on a nano, but have had nothing but trouble with the minis. I have not been able to program using serial and a TTL/USB converter that I know works with the nano. I have changed the ttl/USB to 3V. Only way I can program the mini is using the MOSI/MISO lines and Avrdudess. My original tests of the program were simply changing the flash rate of Blink to make sure it was working... and it did. But with the code to control the 818, I don't think the serial is working and I have tried using the ttl.USB on both the hardware and software serial connections and all I get is gibberish.
Is there a trick to Pro mini serial? Did I get some bad chips?

If you loaded code using the MOSI/MISO lines (ISP programming), you erased the bootloader code. That will need to be put back on the chip before you can load code using the serial port.

I used the .hex file that said with bootloader. But even before I was not able to get it to install using serial. And serial doesn't work on the exact same program only compiled for the 3v8mhz (if that matters in the IDE). Same program worked fine on a nano, but would rather not have to add a 5-3 v converter.

Bob

The ATmega328 in the Pro Mini will run on any voltage between 1.8 and 5V. The only difference between the 5V and 3.3V models should be the voltage regulator and the crystal, as the MCU is not guaranteed to run at 16 MHz when powered by 3.3V.

If you bought a cheap clone, perhaps the "crystal" is not correct, or so far out of spec that the serial Baud rates are wrong, or it is running from an out-of-spec internal 8 MHz RC oscillator.

Occasionally I've had problems with serial on 3.3V Pro Minis when using the internal 8 MHz RC oscillator, but solved it by recalibrating the oscillator. The OSCCAL register can be adjusted for that purpose.

What is a DRA818? How is it connected? You showed no wiring diagram.

Blockquote
Occasionally I've had problems with serial on 3.3V Pro Minis when using the internal 8 MHz RC oscillator, but solved it by recalibrating the oscillator. The OSCCAL register can be adjusted for that purpose.

While looking for the procedure to calibrate my crystal, I did find a note about setting DTR on close and set it. When I tried up a modified blink program as a test, I got the following:

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x8e
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x1c
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xe0
An error occurred while uploading the sketch


Is that an indication of no bootloader?

Blockquote What is a DRA818? How is it connected? You showed no wiring diagram.

DR818 is a ham radio transceiver. For the context of this question, the DRA818 is communicated to by serial text based commands. All that is needed for that is the TX->RX and RX->TX and ground. The code I am using uses software serial for this communication but when compiled as debug, uses the hardware serial to print status and errors. Neither serial seems to be working correctly on the pro mini, but works fine on the nano. If a schematic would really help I can provide create one, but other than the commands, there are just a couple wires that pull up or down to open the mic, change transmit power and sleep (power saving). Again all of these functions worked on the nano and seem to work on the pro mini except the serial communications... Which show garble (non letter/number characters mixed with letters and numbers)

Bob

Historically, on this forum, such verbal descriptions have often been found to be incomplete, and leave out the actual problem. Please post an actual, accurate, complete diagram. A pen and paper version is perfectly acceptable.

The code I am using

Might be the problem, but we can't see it. If it works with the Nano, beware of hardware differences that might need software configuration changes.

73, VE3MIX

Understood. here is the code:

#include <stdio.h>
#include <SoftwareSerial.h>
#include "DRA818.h" // uncomment the following line in DRA818.h (#define DRA818_DEBUG)

/* Used Pins */
#define PD      6  // to the DRA818 PD pin
#define RX      3   // arduino serial RX pin to the DRA818 TX pin
#define TX      4   // arduino serial TX pin to the DRA818 RX pin
#define PTT     5   // PTT pin 
#define TONE    8   // makes tone to transmit

SoftwareSerial *dra_serial; // Serial connection to DRA818
DRA818 *dra;                // the DRA object once instanciated
float freq;                 // the next frequency to scan

void setup(){
  Serial.begin(9600); // for logging

  Serial.println("Booting ...");

  Serial.print("initializing I/O ... ");  
  dra_serial = new SoftwareSerial(RX, TX); // Instantiate the Software Serial Object.
  pinMode(PD, OUTPUT);                     // Power control of the DRA818
  digitalWrite(PD,HIGH);                    // start at low power
  Serial.println("done");
  pinMode(PTT, OUTPUT);
  digitalWrite(PTT, HIGH);

  Serial.print("initializing DRA818 ... ");
  /*
   * Configure DRA818V using 145.500 MHz, squelch 4, volume 8, no ctcss, 12.5 kHz bandwidth, all filters activated
   * We add the &Serial parameter to tell the DRA object where to log its debug information (to the builtin serial)
   *
   * Alternative call:
   *  dra = new DRA818(dra_serial, DRA818_VHF);
   *  dra->set_log(&Serial);
   *  dra->handshake();
   *  dra->group(DRA818_12K5, 145.500, 145.500, 0, 4, 0);
   *  dra->volume(8);
   *  dra->filters(true, true, true);
   */
  dra = DRA818::configure(dra_serial, DRA818_VHF, 145.500, 145.500, 4, 8, 0, 0, DRA818_12K5, true, true, true, &Serial);
  if (!dra) {
    Serial.println("\nError while configuring DRA818");
  }
  freq = DRA818_VHF_MIN;

  Serial.println("done");

  Serial.println("Starting ... ");
  delay(500);
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop(){
  char buf[9];
  if (!dra) return; // do nothing if DRA configuration failed
  digitalWrite(PTT, LOW);
  digitalWrite(LED_BUILTIN, HIGH);
  delay(500);
  tone(TONE,700);
  delay(3000);
  digitalWrite(PTT, HIGH);
  noTone(TONE);
  digitalWrite(LED_BUILTIN, LOW);
  delay(5000);
  //dtostrf(freq, 8, 4, buf);  // convert frequency to string with right precision
  //Serial.print(String("Scanning frequency ") +  String(buf) + String(" kHz ..."));
  /* scan the frequency */
  //if (dra->scan(freq)) Serial.print("Found");
  //Serial.println("");
  
  //freq += 0.0125; //12.5kHz step
  //if (freq > DRA818_VHF_MAX) freq = DRA818_VHF_MIN; // when DRA818_VHF_MAX (174.0) is reached, start over at DRA818_VHF_MIN (134.0)
}

DRA code can be found here: GitHub - fatpat/arduino-dra818: Arduino library for DRA818 VHF/UHF Band Voice Transceiver

And schematic:

PD is power saving, PTT activated the mic and switches from RX to TX mode, Tone is currently just a transmit test. Will be morse code and or musical tones later. AF on the 818 is audio out, goes to a small amplifier and speaker.

Let me know if you have any other questions. This all works on a nano with a 3/5V converter on the pins going to the 818

Bob

I use the built in LED to show that I should be transmitting. It does not go on. I suspect from earlier tests, that the configuration command is failing but like I said the hardware serial is also producing garbage.

The radio is working, and can hear when I transmit from another radio, and if I move the PTT physically to ground, I can hear the 818 transmit. But when the program runs I don't see the light or hear the 818 transmit.

Bob

I was able to load vi avrdudess (not through the serial port) the following code:

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);
  Serial.println("starting...");
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  Serial.println("on");
  delay(3000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  Serial.println("off");
  delay(1000);                       // wait for a second
}

I was able to verify the code uploaded because could see the different timing of the LED, but all serial output was garbage.

Just a thought. When you uploaded, did you select 8MHz clock option? Because, that will affect the serial baud rate if the CPU clock and core baud rate initialization don't match.

I swear these were 3.3/8. I found a script to test the speed using a 10 second on/off of the led. when I compiled it flashed about every 5 seconds. I recompiled as a 5/16 and not only did it blink 10 seconds my serial works.

Thanks for helping my dumb butt. This issue can be closed

Bob

You're welcome, and 73.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.