Ejemplo n.º 1
0
 private void ConfigFX3Device(string FileName, CyUSBDevice myDevice)
 {
     if (MyDevice != null)
     {
         FX3_FWDWNLOAD_ERROR_CODE enmResult = FX3_FWDWNLOAD_ERROR_CODE.SUCCESS;
         CyFX3Device fx3 = myDevice as CyFX3Device;
         if (fx3 != null)
         {
             enmResult = fx3.DownloadFw(FileName, FX3_FWDWNLOAD_MEDIA_TYPE.RAM);
         }
         else
         {
             MessageBox.Show("Please check whether the device is FX3 device", "Device ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
             return;
         }
         if (enmResult != FX3_FWDWNLOAD_ERROR_CODE.SUCCESS)
         {
             MessageBox.Show("Config error", "Device ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
         }
         string report = string.Format("Program {0}\n", fx3.GetFwErrorString(enmResult));
         tbxInfo.AppendText(report);
     }
     else
     {
         MessageBox.Show("Please select the USB device", "Device ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            CyFX3Device fx        = myFX3Device as CyFX3Device;
            string      tmpFilter = FOpenDialog.Filter;

            FOpenDialog.Filter = "Firmware Image files (*.img) | *.img";
            if ((fx != null) && (FOpenDialog.ShowDialog() == DialogResult.OK))
            {
                FX3_FWDWNLOAD_ERROR_CODE enmResult = FX3_FWDWNLOAD_ERROR_CODE.SUCCESS;


                rtConsole.AppendText("Programming RAM of ");
                rtConsole.AppendText(fx.FriendlyName);
                rtConsole.AppendText("........\n");

                string filename = FOpenDialog.FileName;
                Refresh();
                enmResult = fx.DownloadFw(filename, FX3_FWDWNLOAD_MEDIA_TYPE.RAM);



                rtConsole.AppendText("Programming");
                rtConsole.AppendText(fx.GetFwErrorString(enmResult));
                rtConsole.AppendText("\n");
                Refresh();
                firmwaredownloaded = true;

                button1.Enabled = false;
            }
            else if (myDevice != null)
            {
                rtConsole.AppendText("FX3 firmware is already downloaded\n");
                StatLabel1.Text = "NEXT STEP: Use Select Bitstream to select the FPGA .bin file ";
            }

            FOpenDialog.FileName = "";
            FOpenDialog.Filter   = tmpFilter;
        }